Integration Testing
Definition
Integration Testing is the second level of testing, where individually tested units/modules are combined and tested together to verify that they interact correctly — checking interfaces, data exchange, and control flow between modules.
Why It's Needed
A module can pass unit testing perfectly on its own, but still fail when combined with others due to:
- Incorrect interface assumptions (wrong data format/type expected)
- Timing/sequencing issues between modules
- Shared resource conflicts (e.g., database access)
- Incorrect data passed between modules
Integration Testing Strategies
1. Big Bang Integration
- Combine all modules at once and test the whole system together
- Simple but hard to isolate the source of a defect when it fails
2. Top-Down Integration
- Start testing from the top-level module, integrating downward
- Lower-level modules not yet integrated are replaced with stubs
- Advantage: major control logic tested early
- Disadvantage: lower-level modules tested late
3. Bottom-Up Integration
- Start testing from the lowest-level modules, integrating upward
- Higher-level modules not yet integrated are simulated with drivers
- Advantage: low-level utility modules tested thoroughly early
- Disadvantage: overall system behavior/control logic tested late
4. Sandwich (Hybrid) Integration
- Combines Top-Down and Bottom-Up simultaneously, meeting in the middle
- Balances the advantages of both approaches
Comparison Table
| Strategy | Needs Stubs? | Needs Drivers? | Tests Control Logic Early? |
|---|---|---|---|
| Big Bang | No | No | No (all at once) |
| Top-Down | Yes | No | Yes |
| Bottom-Up | No | Yes | No |
| Sandwich | Yes | Yes | Partially (both directions) |
Advantages of Incremental (Top-Down/Bottom-Up) over Big Bang
- Easier to isolate the source of a defect (fewer new modules added at each step)
- Testing can begin earlier, without waiting for the entire system
Exam tip: Memorize the 4 strategies with their stub/driver requirements — a very frequently asked "compare integration testing strategies" question.