Difference between Unit Testing and Sandwich Testing
Last Updated :
24 Mar, 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
Difference between System Testing and Sandwich Testing
1. System Testing : System Testing is also called as the black box testing. It is perform to check whether the software or product meets the specified requirements or not. It is performed by both testers and developers. It comprises the testing's system testing and integration Testing. It is perform
3 min read
Difference between End-to-end Testing and Sandwich Testing
1. End-to-end Testing : End-to-end testing is the type of software testing used to test entire software from starting to the end along with its integration with external interfaces. The main purpose of end-to-end testing is to identify system dependencies and to make sure that the data integrity and
2 min read
Difference between Unit Testing and System Testing
Unit testing involves testing individual components of software in isolation to ensure they function correctly, primarily by developers using automated test frameworks. It focuses on early bug detection and code quality improvement. On the other hand, system testing checks the integrated software sy
4 min read
Difference between End-to-end Testing and Unit Testing
1. End-to-end Testing: End-to-end testing is the type of software testing used to test entire software from starting to the end along with its integration with the external interfaces. The main purpose of end-to-end testing is to identify the system dependencies and to make sure that the data integr
5 min read
Difference between Unit Testing and Integration Testing
Unit Testing: Unit Testing is a type of software testing where individual software components are tested. Unit Testing of the software product is carried out during the development of an application. An individual component may be either an individual function or a procedure. Unit Testing is typical
2 min read
Difference between Integration Testing and Sandwich Testing
1. Integration Testing :Integration Testing is the type of software testing where software modules are integrated logically and tested as a group. Integration Testing major focuses on verifying data communication among these modules. It is the collection of the modules of the software, where the rel
4 min read
Difference between Acceptance Testing and Sandwich Testing
In software development, testing is essential to make sure that an application works as expected, meets user needs, and is free of bugs. Two common testing methods are Acceptance Testing and Sandwich Testing. While both focus on validating software, they take different approaches and have different
3 min read
Difference between GUI Testing and Usability Testing
GUI Testing and Usability Testing are two essential techniques used to evaluate software applications, focusing on different aspects of the user interface and user experience. GUI Testing ensures the visual elements and functionality of the graphical user interface (GUI) are correctly implemented. I
5 min read
Difference between Re-Testing and Smoke Testing
In software testing, different tests are conducted to make sure an application works correctly. Re-testing and smoke testing are two key techniques, but they serve different purposes. Understanding the difference between them is important for developers and testers to ensure the software is of high
4 min read
Difference between Scrum Testing and Waterfall Testing
1. Scrum Testing : Scrum testing is a type of software testing that is the part of agile testing. It is basically a framework used in agile software development process. Scrum testing is used to design the complicated software. It also checks the quality, performance and the usability of the softwar
3 min read