Incremental Integration
Incremental Integration is an approach to integration testing where the application is constructed and tested in small segments. Instead of integrating everything at once (Big Bang), modules are added one by one or in small groups.
1. The Core Concept
The main advantage of this approach is fault isolation. If a bug appears after adding a new module, it is highly likely that the new module (or its interface) is the cause.
2. Top-Down Integration
Testing starts from the top-level modules (User Interface, Main Menu) and moves down to the lower-level modules (Database Access, Utilities).
- Stubs: Since lower-level modules might not be ready, Stubs are used to simulate their behavior. A stub accepts inputs and returns a hardcoded answer.
- Pros: Critical high-level logic and user interfaces are tested early. A working prototype is available quickly.
- Cons: Low-level utilities are tested late. Writing many stubs can be time-consuming.
Example
Testing a "Login Page" (Top) before the "Database Authentication" (Bottom) is ready. The Login Page calls a Stub that always returns true.
3. Bottom-Up Integration
Testing starts from the lowest-level modules (those that don't depend on anything else) and moves up.
- Drivers: Since top-level modules aren't ready to call the lower ones, Drivers are used. A driver is a temporary program that calls the module under test with test data.
- Pros: Useful for systems where low-level performance or complex algorithms are critical. No stubs are needed.
- Cons: The system as a whole (UI) doesn't exist until the very end.
Example
Testing the "Calculate Tax" function (Bottom) using a script (Driver) that feeds it numbers, before the "Checkout Page" (Top) is built.
4. Sandwich Integration (Hybrid)
A combination of Top-Down and Bottom-Up.
- Top Layer: Tested Top-Down using Stubs.
- Bottom Layer: Tested Bottom-Up using Drivers.
- Middle Layer: The target where they meet.
5. Comparison
| Feature | Top-Down | Bottom-Up |
|---|---|---|
| Direction | Main -> Submodules | Submodules -> Main |
| Helper Needed | Stubs (Simulate called functions) | Drivers (Simulate caller) |
| Early Feedback | High (Prototype available) | Low (No UI until end) |
| Best For | UI-heavy apps, rapid prototyping | Low-level systems, critical algorithms |
programming/big-bang-integration programming/software-testing-basics programming/software-development-life-cycle