Sandwich Testing is a hybrid integration testing approach that combines Top-Down and Bottom-Up integration testing. It is mainly used in large, multi-layered systems where modules are developed and tested simultaneously. By testing from both the top and bottom layers at the same time, it helps detect integration defects early and reduces overall testing time.
- Uses both stubs and drivers during integration testing.
- Enables parallel testing of multiple layers.
- Improves integration efficiency in complex applications.

Strategy Used in Sandwich Testing
Sandwich Testing uses a hybrid integration strategy that combines Top-Down and Bottom-Up Integration Testing to integrate and test different layers of the software system.
- Top-Down Integration: Higher-level modules are integrated and tested first, moving toward lower-level modules. Stubs may be used for unavailable lower-level modules.
- Bottom-Up Integration: Lower-level modules are integrated and tested first, moving toward higher-level modules. Drivers may be used for unavailable higher-level modules.
- Parallel Integration: Top-Down and Bottom-Up integration can be performed concurrently, allowing different parts of the system to be tested in parallel.
- Middle-Layer Integration: The upper and lower portions are eventually integrated through the middle layer to complete the integration process.
- Stub and Driver Usage: Stubs and drivers are used when necessary to simulate unavailable dependent modules.
Sandwich Testing Process
Sandwich Testing combines Top-Down and Bottom-Up Integration Testing by integrating modules from both higher and lower levels and eventually connecting them through the middle layer.

- System Division: The system is divided into higher-level, middle-level, and lower-level modules.
- Top-Down Integration: Higher-level modules are integrated and tested toward the middle layer, using stubs when required to simulate lower-level modules.
- Bottom-Up Integration: Lower-level modules are integrated and tested toward the middle layer, using drivers when required to simulate higher-level modules.
- Parallel Integration: The Top-Down and Bottom-Up integration activities can be performed in parallel, depending on module availability and project requirements.
- Middle-Layer Integration: The modules integrated from both directions are connected through the middle layer and tested for proper interaction.
- Final Integration Testing: After all relevant modules are integrated, the complete system is tested to verify that the integrated components work together correctly.
Three-Layer Architecture of Sandwich Testing
Sandwich Testing organizes the application into three logical layers to support simultaneous integration from both directions.
- Top Layer: Contains high-level modules that are tested using the Top-Down approach.
- Middle Layer: Acts as the target integration layer where the Top-Down and Bottom-Up testing paths meet.
- Bottom Layer: Contains low-level modules that are tested using the Bottom-Up approach.
Step-by-Step Sandwich Testing on a Module Hierarchy
The following example shows how Sandwich Testing can be applied to a system consisting of seven modules arranged across three layers.

Module Structure
- Layer 1 (Top): Module 1
- Layer 2 (Middle): Modules 2, 3, and 4 (children of Module 1)
- Layer 3 (Bottom): Modules 5 and 6 (children of Module 2) and Module 7 (child of Module 4)
Bottom-Up Testing
- Leaf modules 5, 6, and 7 are tested individually.
- Modules 5 and 6 are integrated with Module 2 and tested as a unit.
- Module 7 is integrated with Module 4 and tested as a unit.
Top-Down Testing
- Module 1 is tested with simulated lower-level dependencies where required.
- Module 1 is progressively integrated with Modules 2, 3, and 4.
- Module 3 can be tested directly with Module 1 because it has no lower-level child modules.
Convergence at the Middle Layer
- The modules integrated from the bottom are connected with the corresponding modules integrated from the top.
- The remaining modules and their interactions are integrated and tested.
- The complete system containing Modules 1 through 7 is finally tested to verify that all integrated modules work together correctly.
Suitable Scenarios for Sandwich Testing
Sandwich Testing is useful in the following situations:
- Large and Complex Applications: Suitable for systems with multiple interconnected modules and dependencies.
- Multi-Layer Software Architecture: Works well when the system is organized into multiple levels or layers.
- Parallel Development and Testing: Allows higher-level and lower-level modules to be tested concurrently when their dependencies are available.
- Incremental Module Integration: Can be useful when modules are developed and integrated in stages.
- Early Integration Defect Detection: Helps identify defects while different parts of the system are being integrated.
- Large Development Teams: Can allow different teams to work on and test different levels of the system concurrently.
Advantages of Sandwich Testing
Sandwich Testing offers several benefits by combining Top-Down and Bottom-Up Integration Testing.
- Helps detect integration defects at an early stage.
- Provides coverage across different levels of the software system.
- Improves the efficiency of the integration process.
- Works well for large and complex applications.
- Allows different modules to be integrated and tested independently.
- Reduces integration risk by testing modules from both directions.
Limitations of Sandwich Testing
Sandwich Testing has some limitations due to its complex integration process and dependency on multiple modules.
- Works best with layered or multi-level software architectures.
- Requires careful planning and coordination.
- May require both stubs and drivers when dependent modules are unavailable.
- Can increase the initial testing effort and cost.
- Middle-layer integration may depend on the availability of related modules.
- Defect isolation can be challenging during integration.