Difference between Unit Testing and Sandwich Testing


Unit testing and sandwich testing are two different types of software testing techniques. In Unit testing, the individual units of a software product are tested in isolation from the rest of the application. Sandwich testing, on the other hand, focuses on testing the interactions between multiple units of a software product.

Read this article to learn more about unit testing and sandwich testing and how these two testing techniques are different from each other.

What is Unit Testing?

Unit testing is a type of testing in which a single module is tested at a time. Unit testing checks if the individual units of an application function as intended. Unit testing is also known as white box testing. As a single module is tested at a time, the focus of the tester is on the internal design of the application as well.

Unit testing is performed as the first stage of testing; it is generally performed by developers of the application. Unit tests are carried out every time the code is changed to ensure that no bugs have been introduced and that existing functionality is still intact. Defects get easily identified and are locked as per module.

Unit testing generally does not depend on the size of project so it can be performed in both small and large sized projects. Parallel testing is not supported in unit testing because a single module is tested at a time.

What is Sandwich Testing?

In software development, sandwich testing is a type of testing where each module is treated as a separate target for testing and these modules are integrated one by one after completing the test. Sandwich testing is also known as integration testing.

Sandwich testing comprises top-down and bottom-up approaches of testing. It supports parallel testing, thus multiple modules can be tested simultaneously. However, sandwich testing cannot be used for testing of such systems that have a lot of interdependence among different modules.

Sandwich testing is generally performed by the development team of the product. It involves testing the application as a whole rather than individual units, and it is performed after unit testing and before system testing.

Difference between Unit Testing and Sandwich Testing

The following are the important differences between unit testing and sandwich testing −

Key

Unit Testing

Sandwich Testing

Definition

Unit testing is a testing in which tester tests only single module at a time and not the integrated version of the application.

Sandwich testing is a type of testing where each module is treated as separate target for testing and these modules are getting integrate one by one after testing completed on them.

Approach

In unit testing, single module testing approach is practiced.

It comprises the bottom-up approach testing and the top-down approach testing.

Defects

As a single module is tested at a time, so defects get easily identified and are locked as per module.

Modules get integrated after testing, so defects are not easily identified as modules are dependent on each other up to some extent.

Practice and Preference

Unit testing generally does not depend on the size of a project, so it can be performed in both small and largesize of projects.

Sandwich testing is mostly preferred in largesize projects, as they have more number of modules.

Parallel Testing

Parallel testing is not supported in Unit testing.

Parallel testing is supported as multiple modules can get tested in parallel.

Cost effective

Unit testing have less cost as compare to Sandwich testing as less number of resources are required in this type of testing.

Cost is comparatively higher as more number of resources is required in this type of testing.

Performance

The performance of unit testing is higher as compared to Sandwich testing, as a single module is tested at a time.

Sandwich testing has lower performance as compared to Unit testing, as multiple and integrated modules get tested at the same time.

Conclusion

The most significant difference that you should note here is that unit testing is a testing technique in which the tester tests only a single module at a time, whereas sandwich testing is a type of testing where each module is treated as separate target for testing and these modules are integrated one by one after the testing is complete.

Updated on: 22-Feb-2023

266 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements