Difference between Unit Testing and Sandwich Testing
Last Updated :
19 Jul, 2025
Unit Testing: Unit Testing is the type of Software Testing level in which each individual components of a software are tested. Unit Testing is generally performed by the developer. Unit Testing can’t be used for those systems which have a lot of interdependence between different modules. It does not allow for parallel testing.
Sandwich Testing: Sandwich Testing is also known as hybrid integration testing. Sandwich Testing comprises the bottom-up approach testing and top-down approach testing, therefore it uses the advantage of both the bottom-up approach and top-down approach. Sandwich Testing also can not be used for those systems that have a lot of interdependence between different modules and it allows parallel testing. of interdependence between different modules and it allows parallel testing.
Sandwich TestingDifference between Unit Testing and Sandwich Testing
Here is the Difference between Unit Testing and Sandwich Testing
S.NO | Unit testing | Sandwich testing |
---|
1. | In unit testing, software module are tested separately. | Sandwich testing comprise the top-down and bottom-up testing. |
---|
2. | Defects are identified easily in unit testing. | Defects are not identified easily in sandwich testing testing. |
---|
3. | In Unit testing does not matter how big project is. | Sandwich Testing is used for very large projects having sub projects. |
---|
4. | Unit testing is cost efficient. | Sandwich testing is not cost efficient. |
---|
5. | Unit testing does not allow parallel testing. | Sandwich testing allows parallel testing. |
---|
6. | Unit Testing can’t be used for those systems which have a lot of interdependence between different modules. | Sandwich Testing also can not be used for those systems which have a lot of interdependence between different modules. |
---|
7. | In Unit testing, there is need of fewer resources for testing. | In Sandwich testing, there is need of large number of resources. |
---|
8. | Unit testing is typically done by developers. | Sandwich testing is done by both developers and testers. |
---|
9. | Unit tests are typically done early in the development process. | Sandwich tests are done later. |
---|
10. | Unit tests are usually small and focused. | Sandwich tests are larger and more comprehensive. |
---|
11. | Unit tests are used to verify the functionality of individual units. | Sandwich tests are used to verify the functionality of the system as a whole. |
---|
12. | Unit tests are typically run manually. | Sandwich tests may be run automatically. |
---|
13. | Unit tests are typically written in the same language as the code being tested. | Sandwich tests may be written in a different language. |
---|
14. | Unit tests typically focus on functional testing. | Sandwich tests may also include non-functional testing. |
---|
15. | Unit tests are typically not concerned with scalability. | Sandwich tests may include scalability testing. |
---|
16. | Unit tests are typically not concerned with usability. | Sandwich tests may include usability testing. |
---|
17. | Unit tests are typically run on the development environment,. | Sandwich tests are usually run on the production environment. |
---|
18. | Unit tests are typically black box tests. | Sandwich tests may be white box tests. |
---|
19. | Unit tests typically do not require knowledge of the internals of the code being tested. | Sandwich tests may require knowledge of the internals. |
---|
20. | Unit tests are typically limited to a single component. | Sandwich tests may span multiple components. |
---|
21. | Unit tests are typically used to find bugs, | Sandwich tests are also used to verify system quality. |
---|
What is unit testing?
Unit testing is the process of testing the smallest parts of your code, like individual functions or methods, to make sure they work correctly. It’s a key part of software development that improves code quality by testing each unit in isolation.
Workflow of Unit testingYou write unit tests for these code units and run them automatically every time you make changes. If a test fails, it helps you quickly find and fix the issue. Unit testing promotes modular code, ensures better test coverage, and saves time by allowing developers to focus more on coding than manual testing.
Unit Testing Techniques
There are 3 types of Unit Testing Techniques. They are follows
- Black Box Testing: This testing technique is used in covering the unit tests for input, user interface, and output parts.
- White Box Testing: This technique is used in testing the functional behavior of the system by giving the input and checking the functionality output including the internal design structure and code of the modules.
- Gray Box Testing: This technique is used in executing the relevant test cases, test methods, and test functions, and analyzing the code performance for the modules.
What is Sandwich Testing?
Sandwich Testing combines the bottom-up and top-down approaches, so it uses the advantage of both the bottom-up and top-down approaches. Initially, it uses the stubs and drivers where stubs simulate the behavior of a missing component. It is also known as Hybrid Integration Testing.
Strategy Used in Sandwich Testing
Sandwich Testing combines both top-down and bottom-up strategies. It can be thought of as having three layers:
- Main Target Layer
- Layer Above the Target Layer
- Layer Below the Target Layer
In Sandwich Testing, the focus is mainly on the main target layer, where the testing is conducted. The approach is chosen based on the system's characteristics and the structure of the code.
When there are more than three layers, Sandwich Testing aims to reduce the number of hubs and drivers needed for testing, making the process more efficient.
When to Use Unit Testing and Sandwich Testing
Unit Testing is best used when:
- You need to test individual functions or methods.
- You want to make sure small, isolated parts of your code work correctly.
- You’re in the early stages of development and want to catch bugs early.
Sandwich Testing is best used when:
- You need to test how different modules interact within the system.
- You’re working with a large and complex system with many interconnected components.
- You want to ensure the modules work well together from both the top and bottom levels.
Conclusion
Both Unit Testing and Sandwich Testing are essential for ensuring high-quality software. Unit Testing focuses on testing individual components, while Sandwich Testing looks at how different modules work together. By knowing when to use each method, developers can create robust, reliable software that meets user expectations.
Similar Reads
Software Testing Tutorial Software testing is an important part of the software development lifecycle that involves verifying and validating whether a software application works as expected. It ensures reliable, correct, secure, and high-performing software across web, mobile applications, cloud, and CI/CD pipelines in DevOp
10 min read
What is Software Testing? Software testing is an important process in the Software Development Lifecycle(SDLC). It involves verifying and validating that a Software Application is free of bugs, meets the technical requirements set by its Design and Development, and satisfies user requirements efficiently and effectively.Here
11 min read
Principles of Software testing - Software Testing Software testing is an important aspect of software development, ensuring that applications function correctly and meet user expectations. From test planning to execution, analysis and understanding these principles help testers in creating a more structured and focused approach to software testing,
3 min read
Software Development Life Cycle (SDLC) Software Development Life Cycle (SDLC) is a structured process that is used to design, develop, and test high-quality software. SDLC, or software development life cycle, is a methodology that defines the entire procedure of software development step-by-step. The goal of the SDLC life cycle model is
8 min read
Software Testing Life Cycle (STLC) The Software Testing Life Cycle (STLC) is a process that verifies whether the Software Quality meets the expectations or not. STLC is an important process that provides a simple approach to testing through the step-by-step process, which we are discussing here. Software Testing Life Cycle (STLC) is
7 min read
Types of Software Testing Software testing is a important aspect of software development life-cycle that ensures a product works correctly, meets user expectations, and is free of bugs. There are different types of software testing, each designed to validate specific aspects of an application, such as functionality, performa
15+ min read
Levels of Software Testing Software Testing is an important part of the Software Development Life Cycle which is help to verify the product is working as expected or not. In SDLC, we used different levels of testing to find bugs and errors. Here we are learning those Levels of Testing in detail.Table of ContentWhat Are the Le
4 min read
Test Maturity Model - Software Testing The Test Maturity Model (TMM) in software testing is a framework for assessing the software testing process to improve it. It is based on the Capability Maturity Model(CMM). It was first produced by the Illinois Institute of Technology to assess the maturity of the test processes and to provide targ
8 min read
SDLC MODELS
TYPES OF TESTING