To know whether integration testing can be performed without unit testing, it would be better to have a generalized understanding of unit testing and integration testing. Upon that, it would also be a wise idea to understand the differences between integration testing vs unit testing.
What is unit testing?
It is a testing method where small pieces of code known as units are tested. Each unit of the code is validated to know whether it works as expected. It is the first testing phase of the Software Testing Life Cycle (STLC) and is performed during the development phase of an application by developers.
What is Integration testing?
It is a testing method where two or more components, modules or units are tested as a group. The ways they interact and behave when they combine are analyzed. This testing method uncovers defects when there is an interaction happening between the modules that have been integrated.
Moreover, both integration tests and unit test aim to ensure that your library's many parts function correctly together. The important points that contrast integration testing vs unit testing are listed below.
Unit testing vs Integration testing:
Unit testing:
• Small pieces of code known as units are tested
• It is limited in scope as it covers only a single piece of code known as unit
• The internal design of the software is known by the tester
Integration testing:
• Two or more modules or units are combined and tested as a group
• It has a wider scope as the broader part of the application is tested
• The internal design of the software is not known by the tester.
Performing integration testing without unit testing:
It is way better to initiate the testing process with unit testing first and then carry out the integration testing process. In fact, after unit testing, the second testing phase of the Software Testing Life Cycle (STLC) is Integration testing.
There is one specific area where integration testing is performed without unit testing and that is when the test coverage of the legacy code is being processed. Legacy code is complex and unit tests cannot be written for it in most cases.
Instead, characterization tests need to be written. These are the integration tests through which the integration tests are covered. Once the characterization tests are set in place, the code can be refactored toward better testability.