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
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
Types of Software Testing Software testing is a important 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, performance, se
15+ 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
Differences between Black Box Testing and White Box Testing In the Software Testing field, various methods are used to find defects, which used to increasing the software's quality. Black-Box Testing and White-Box Testing play important roles in these process.Let's Learn about them in detail.Table of ContentWhat is Black Box Testing?What is White Box Testing
6 min read
Black Box Testing - Software Engineering Black Box Testing is a Software testing method in which the internal working of the application is not known to the tester. The Black Box Testing mainly focuses on testing the functionality of software without any knowledge of the internal logic of an application. Here we are learning the topics rel
12 min read
What is Agile Methodology? The Agile methodology is a proper way of managing the project with breaking them into smaller phases which is iteration. It basically focus on flexibility of the project which we can change and improve the team work regularly as per requirements.Table of ContentWhat is Agile?What is the Agile Method
14 min read
Software Testing Interview Questions and Answers Software testing is the process of checking if a software application meets requirements and works as expected. Its main goal is to find defects or bugs and ensure the software is reliable and performs well in different situations. This skill is essential for maintaining high-quality products at com
15+ min read
White box Testing - Software Engineering White box testing techniques analyze the internal structures the used data structures, internal design, code structure, and the working of the software rather than just the functionality as in black box testing. It is also called glass box testing clear box testing or structural testing. White Box T
14 min read
Unit Testing - Software Testing Unit Testing is a software testing technique in which individual units or components of a software application are tested in isolation. These units are the smallest pieces of code, typically functions or methods, ensuring they perform as expected. Unit testing helps identify bugs early in the develo
12 min read
Verification Vs Validation Verification and Validation is the process of investigating whether a software system satisfies specifications and standards and fulfills the required purpose. Verification and Validation both play an important role in developing good software development. Verification helps in examining whether the
6 min read