Learn about the benefits that implementing integration testing can bring to your business from Ten10 Consultant, Charlotte Hayes
Integration testing allows for early sight of any coding issues or functions that are not working together. It can identify the root cause more efficiently than when all the modules have been merged for system testing. Spotting these issues early reduces wasted time and improves cost efficiency.
Here’s the essential information you need to know about integration testing:
What is integration testing?
Integration testing is the testing of different units, software modules or components as one combined system. There could be many different modules developed, some from different third parties or in-house development teams which should integrate and communicate together.
Integration testing is usually conducted after unit testing, where the development teams test the small pieces of code in isolation initially and then once all other modules have been developed integration testing can commence.
If a company has a more complex architecture to develop there is more risk of individual modules or components not communicating or working well together such as exception handling or API responses. One developer could interpret a requirement differently from the other, therefore this phase of testing must not be missed out.
What approaches to integration testing do people use?
There are many types of approaches that can be taken to conduct integration testing depending on the infrastructure or architecture of the integrations that have been developed.
Two of the most useful to understand are:
- Incremental testing
- Big bang testing
Incremental testing can be performed slowly, integrating one module at a time to test until all of them have been integrated and have been tested as a whole. This approach allows you to test one module at a time, giving you earlier sight of defects and easier root cause identification.
These defects can usually be resolved by a developer without having to rewrite all the modules. There are different approaches to incremental testing, including:
- Bottom-up integration testing: Where the testing starts at the lowest modules and works upwards to test. This could be because the top modules have not been developed yet and the flow of data starts from the bottom and works upwards. Stubs or drivers could be put in place for the modules that have not been developed yet and validate the modules’ integrations. This can be an efficient way to test early and not be held up by slow development.
- Top-down integration testing: Conducted from the topmost module within the company’s architecture flow with the testing being conducted from top to bottom using stubs for any lower modules that have not been developed yet. Interface errors can be identified earlier with this approach because of it being incremental and using a stub to support the testing.
- Sandwich integration testing: A mixture of both top-down and bottom-up where you test both top and bottom modules simultaneously to reach the middle modules.
Big bang testing
Another popular approach is big bang testing where once all the modules have been developed, they are all integrated and tested together at the same time. This approach suits a smaller platform where only a few modules are being developed so there is a lower risk of many issues being identified.
One drawback of this approach is that you can only test once all the modules have been developed – if any modules are behind schedule, this can delay testing and become both costly and time consuming.
Advantages of integration testing
The advantages of conducting integration testing are mainly that it improves the quality of the software being released by identifying issues between modules early in the software development lifecycle. It gives an extra layer of test coverage and confidence that the system as a whole would work together well.
If you skip or miss this phase of testing then issues are more likely to be found in the live environment by real users. This leads to low confidence and reliability of the software, and users may be less likely to use the software again if they have found it difficult the first time.
Integration testing tools
Many automated test tools can be used to help simulate integration testing, including:
- Selenium: An open-source suite that facilitates automated web application testing and can help developers with integration testing by running quick tests against separate modules.
- Pytest: A Python testing tool which enables small tests to be written easily and also scales to support complex testing for applications and libraries.
- Citrus: A test framework which helps you automate integration testing as it uses data formats and validates JSON, XML and plain request and response data.
Integration testing best practices
- Ensure the development team has conducted unit testing before you start integration testing to make sure all the modules are working separately before you start testing them together.
- Make sure you understand the difference between unit testing and integration testing as they will find different types of defects. Unit tests are very small bits of code that are tested in isolation, whereas integration testing tests more complex modules together. This usually requires infrastructure support or different tools to support the testing.
- Try to ensure your test suites are kept and run separately from unit tests so that the developers can keep their unit test code separate and rerun them when defects are identified.
- Use integration tests as part of CI/CD pipelines as this can improve code quality and make the running of the tests more efficient and streamlined within a dedicated environment so you aren’t waiting for your tests to finish when you need to carry on developing another feature.