Testing plays a critical role in the software development process. You would never buy a car that hasn’t passed its emission tests or crash tests. If you don’t test your software, you face the potential of receiving a broken product or one that doesn't meet your requirements. There are many different types of testing, including integration testing, and each type of test serves a different purpose.
Integration Testing Overview
Let’s take a look at Integration Testing, a type of functional test. Where unit testing involves boiling the software down to its smallest components, integration testing is combining components and testing them as a group. The goal of integration testing is to ensure that different components work to their specified functional requirements.
Let’s take a door as an example, and conduct an integration test. To have a normal door working properly, there are a few things that you need to work. Let’s combine a handful of components and represent the function of opening the door as a whole.
- The door knob needs to twist and subsequently move the bolt.
- When opening the door, the hinges need to move seamlessly.
- The door itself needs to open in the proper direction.
Individually, all these pieces may work, thus passing their unit tests. But if they don’t work together, then the door has failed the integration test and doesn't work to its specified functional requirements.
Integration Testing Strategies
There are four common strategies to Integration Testing: Big Bang, Top-Down, Bottom-Up, and Sandwich.
Big Bang integration testing is when all of the components are combined and tested at once. The Big Bang method may seem more time-friendly at first because all tests are performed at once. However, the method can be less effective in the long run since it only tests the system as a whole and doesn't isolate specific components. The Big Bang method may therefore cause you to overlook potential errors, leading to more issues later.
The top-down method of integration testing involves simulating the lower level components that have yet to be integrated to the system. The top-down method allows the tester to write placeholders, known as stubs, for lower-level modules that haven't been implemented yet. Since the tester knows the expected outcome of these lower-level modules, they can simply write a stub that spits out the desired output.
Top Down offers several advantages including quicker testing. This is because stubs can be written more quickly than the lower-level modules they are replacing. In some cases, lower-level modules may depend on external input or even components from other teams, so it will save time to replace them with stubs when testing top-level components.
In contrast to top-down, bottom-up integration testing is when you test the lower levels of the system first. As the higher modules are completed, the tests continue, but always starting with the bottom. The bottom-up method is complete when the highest level component is tested and approved. While the bottom-up integration testing strategy is thorough, it can take more time and may not dedicate enough attention to testing key high-level components.
Sandwich integration testing, also know as hybrid integration testing, is a method that combines the advantages of both top-down and bottom-up strategies. Sandwich testing involves testing high-level modules and working down, while simultaneously performing tests on low-level modules and working up.
By combining both strategies, the tester is able to create a "best of both worlds" scenario. However, the sandwich method is often more expensive and effort intensive than the other strategies. Furthermore, if there are many interdependencies between modules, sandwich testing may not be a feasible approach.
Pros of Integration Testing
Why should you perform integration testing? The main arguments in favor of integration testing are that it:
- ensures the functionality of components meet the requirements
- allows the development team to test a system as a whole
- can be done once any relevant module is complete without requiring the entire project to be completed
Cons of Integration Testing
If the benefits of integration testing are so great, why would anyone want to skip it? The main arguments against performing integration testing are that it:
- can be extremely time-consuming if the system is fairly complex with many parts, or if there are many bugs
- can have common pitfalls depending on which integration testing strategy you choose, resulting in overlooking certain modules
At Aloa, we believe that integration testing is a key part of a successful development process. The specific strategy you choose to use is dependent on your system, and we hope our integration testing overview was helpful in making your decision.
Still have questions? Email us at email@example.com and we can help answer your questions 🙂