Sandwich Integration (Hybrid)
Sandwich Integration (also known as Hybrid Integration) is a testing strategy that combines the strengths of both Top-Down and Bottom-Up approaches. It targets the middle layer of the system while simultaneously testing the top and bottom layers.
1. The Concept
In large systems, pure Top-Down or Bottom-Up approaches can be inefficient. Sandwich integration attempts to reap the benefits of both by testing the system in three layers:
- Top Layer: The User Interface or main control modules.
- Middle Layer: The target logic or middleware.
- Bottom Layer: Database, file system, or low-level utilities.
2. How it Works
Testing happens in parallel:
- Top-Down: Testing starts from the UI and moves down. Stubs are used to simulate the Middle layer.
- Bottom-Up: Testing starts from the low-level modules and moves up. Drivers are used to simulate the Middle layer calling them.
- Convergence: The Middle layer is integrated last, replacing the stubs and drivers.
3. Pros and Cons
| Pros | Cons |
|---|---|
| Parallel Testing: Top and Bottom layers can be tested simultaneously. | Complexity: Requires managing both Stubs and Drivers. |
| Early Feedback: UI is available early (Top-Down benefit) and critical low-level logic is verified (Bottom-Up benefit). | Cost: High overhead in creating test doubles. |
| Fault Isolation: Easier to isolate bugs in the specific layer being integrated. |
4. When to use it?
- Large Systems: Where separate teams work on UI, Logic, and Database.
- Middleware-Heavy Apps: Systems like Operating Systems or complex APIs where the middle layer is the core.
programming/incremental-integration programming/software-testing-basics programming/software-development-life-cycle