Sandwich Integration Testing
You'll learn how to combine top-down and bottom-up integration testing to test a system from both ends simultaneously.
What Is Sandwich Testing?
Sandwich integration testing (also called hybrid integration testing) merges the top-down and bottom-up approaches you've already learned. Instead of choosing one direction, you test from both the top and bottom layers simultaneously, working toward the middle layers of your system.
How It Works
Imagine a three-layer application: UI at the top, business logic in the middle, and database access at the bottom.
With sandwich testing:
- Top-down team starts at the UI layer, using stubs for middle-layer functions, testing downward
- Bottom-up team starts at the database layer, using drivers to call upward, testing the data access components
- Both teams converge toward the middle (business logic layer)
- Finally, you integrate and test the middle layer that connects both ends
Think of it like building a sandwich from both slices of bread simultaneously—you're constructing from the top and bottom until they meet at the filling.
When to Use It
Sandwich testing is valuable when:
- You have parallel teams that can work simultaneously
- The middle layers are complex and benefit from being tested last
- You want to maximize early defect detection across all layers
- Critical components exist at both architectural extremes
Trade-offs
The main advantage is speed—parallel testing reduces overall integration time. However, it requires more coordination between teams and careful planning about where the two approaches will meet and integrate.
Key Takeaway: Sandwich integration testing combines top-down and bottom-up strategies to test from both architectural extremes simultaneously, converging toward the middle layers for faster overall integration.