Integration Testing- An Overview
As we have discussed in the Types of Software Testing guide, integration testing is the second phase of software testing that follows unit testing. Here, individual software units or components are tested as a whole for functionality. This ensures that no bugs creep in when individual units are integrated.
The process of integration testing involves identifying relevant modules that need testing once integrated, defining test cases for the interaction between these modules, and deciding test input data for this test case execution, following which any bugs can be reported and fixed.
Integration testing is then done via an incremental approach where modules are added in their logical sequence and then tested for correctness. It can also be done in a non-incremental fashion in cases where the modules are interconnected in a more complex manner. Here, the modules are tested against other existing modules in a ‘big bang’ method.
In this manner, integration testing ensures that all software modules work cohesively and helps fix integration issues early on in the Software Development Lifecycle (SDLC).
Why Integration Testing?
Integration testing is of even more relevance in today’s dynamic and fast-paced IT landscape, where requirements change on the fly, and release deadlines are shorter than ever. Here are some scenarios that suggest why integration testing is important:
- When data travels from one module/unit to another, chances are that its structure and integrity may be altered, causing issues to develop in later modules.
- While unit testing, each developer follows their own logic while testing separate modules. When several such disparate modules are combined, unforeseen functional errors may occur, causing the application to work in an unintended manner.
- As requirements keep changing over time, some of them may not be unit tested before being integrated. Once again, integration testing helps to catch missed defects in such scenarios.
- Integration testing also helps solve common challenges such as API response generation, incorrect exception handling, data formatting, and error trapping.
How is Integration Testing Performed?
An integration testing plan usually covers the following steps:
- Preparation of the integration tests plan
- Development of test case scenarios
- Execution of these test cases
- Tracking and re-checking of defects
Types of Integration Testing
Integration testing may be broadly classified into:
1) Incremental integration testing and
2)Non-incremental integration testing
1) Incremental Integration Testing
In the incremental approach, each module is added one by one in ascending order, in logical relation to the next. Two to three modules are tested for their functionality and in this manner, the entire sequence of modules is successfully tested. Incremental integration testing can be further divided into:
- Top-Down Approach: Here, all modules are added incrementally; higher-level modules are tested with lower-level modules till all modules are successfully tested. As critical modules are tested first, major defects can be fixed earlier.
- Bottom-Up Approach: Here, lower-level modules are tested with higher-level modules till all modules are successfully tested. Critical modules are tested last in this case.
- Hybrid Approach: Here, both Top-Down and Bottom-Up approaches are combined, further reducing the chances of defect occurrence.
2) Non- Incremental (Or Big Bang) Integration Testing
Non-incremental integration testing is performed when the data flow is so complex that linear relations between modules are hard to ascertain. Here, data in any one module is banged against all other modules to check if the data is present. As this type of integration testing can be performed only after all modules have been completed, it leaves relatively less time for execution.
Advantages of Integration Testing
- Each integrated module is tested for functionality.
- With incremental integration testing, time taken for testing is saved as testers can begin testing with those modules that have already been completed.
- Interface errors can be quickly uncovered.
- Integration testing provides testers with a comprehensive overlay of the entire application.
Challenges of Integration Testing
- Integration testing commonly involves the use of two separate systems from two different vendors, complicating how their components will interact with each other.
- Similarly, integrating new and legacy systems comes with its own set of challenges.
- Several different platforms and databases may need to be integrated, further increasing the complexity of integration testing.
- Integration testing may also require testing of the environment apart from the integrated modules, adding a further layer of complexity.
Integration Testing Best Practices
- Determine an integration test strategy at the outset- this can be later adopted to develop and execute relevant test cases.
- Critical modules need to be tested on priority.
- After building the required test cases, be sure to develop the associated test data, before proceeding to execute the test cases.
- Build extensive reporting on all detected bugs and relay them to the development team. After these bugs are fixed, ensure to carry out testing once again.
- Ensure that each module has been unit tested, before performing integration testing.
- While performing integration testing, make sure to refer to the documentation on the technical architecture. This helps to understand how each module interacts with the other.