Difference between Unit Test Vs Integration Test

Introduction

In this article, we are going to discuss Difference between Unit Test Vs Integration Test. We should agree to the fact that any software application system that we use in our daily life should be fully practical and functional without any fault or software defect.

Let’s take an example of our personal computer (PC). A PC has a monitor, motherboard, mouse, microprocessor, DVD player, RAM, hard disk, keyboard, etc. All of these parts are manufactured separately and individually tested before they could be assembled into a PC. Again different motherboard supports different microprocessor like 32 bit or 64 bit, different capacity RAM, hard disk, etc. Thus, in order to carve a complete computer system, compatibility test is done after integration test. When complete system is assembled into PC, a system test is done to check all assembled part are working as expected. Once PC is ready to use then it undergoes acceptance test done by the end user or the vendor who sells PC in the market.

In the similar way a software application is developed into different modules and each module is unit tested and then these modules are well integrated in a desired sequence for the integration testing. This constitutes entire system which undergo system testing to test that after integration of all modules they together working as expected as a software application. Once system is tested it undergoes acceptance test by client or end user. Given below is an flow chart for system testing approach.

 

System testing approach

 

System Testing Approach:

  • UNIT TESTING: When code is written for various project modules, it is tested at the unit level. Since this testing requires knowledge of code therefore, it is also known as white box testing and usually carried out by the developer. There are various frameworks available to perform unit testing. They are Junit and TestNG which are widely used for Java based unit testing. Similarly, Nunit is used for .net based applications.
  • INTEGRATION TESTING: Unit tested modules are integrated to form a system, in this testing compatibility of modules are tested i.e. whether they are working as expected when integrated together or not. Usually various modules are integrated in a desired sequence that ensure data flow from upstream module to downstream module or bi-directional flow in case of request and response model for software applications.
  • SYSTEM TESTING: System testing is also known as black box testing or functional testing and it is conducted to test the overall functionality of the system which should behaving as expected or specified in functional requirements document.
  • ACCEPTANCE TESTING: Once system is ready to use, it undergoes testing by end user or client to verify that it meets the user expectations and all desired functionalities as specified in SRS (Software Requirements Specification) document.

 

Advantages of System Testing in terms of Unit and Integration Testing

  • System testing covers full end to end testing after well unit tested and integrated testing as a complete system.
  • System software architecture and business requirements are both tested in system testing. As a pre-requisite, unit testing and integration testing are must.
  • Proper system testing helps in mitigating after production go live issues and defects.
  • System testing is conducted in an environment similar to that production environment or sometimes it is done with prod parallel test environment where same data is feed to exiting system and new system to compare the differences in functionalities added and removed. Such environment is also known as SIT (System Integration Test) environment. It helps the user to understand the new system better and feel comfortable with new functionalities added or existing functionalities amended or removed.
  • User acceptance testing and performance testing are done on a separate environment which is known as UAT (User Acceptance Test) environment. This environment has data which resembles production data as well as production like infrastructure in order to procure accurate results both in terms of functional and non-functional testing.

 

Difference between Unit Test Vs Integration Test:

Given below is the point by point difference between Unit Test Vs Integration Test.

Integration Testing Unit Testing
The impression behind Integration Testing is to integrate all modules into the application and test them as a group to observe that they are working as expected. The impression behind Unit Testing is to test each part of the individual module and observe that the individual parts are working as expected.
It is also known as black box testing and internal code of the application module is not visible and focus is on the given input and the expected output. It is also known as white box testing as it requires the knowledge of the code and the control flow within the program.
Integration testing is carried out after unit testing but before system testing. Unit testing can be performed anytime but always before integration testing.
Defects in Integrating testing are detected after modules are integrated to build the overall system Unit Testing tests only the functionality of the modules at unit level and can not catch integration level defects, or any other system-wide issues.
It surfaces from interface specifications. It surfaces from module specification.
It is mainly focused on module integration. It is mainly focused on the functionality of an individual module.
Integration testing is conducted by testers. Unit testing is usually conducted by developers.
Error detection’s are usually difficult at integration testing. Error detection’s are usually simple at unit testing.
Integration test maintenance is quite expensive as it requires the separate environment setup. Unit test maintenance cost is very less as it is maintained and unit level with the help of Junit, Nunit, TestNG, etc.
Integration tests helps to verify that our code works as expected with the external dependencies. Unit test does not verify if our code works as expected with the external dependencies.

 

Conclusion:

In this article, we discussed both Difference between Unit Test Vs Integration Test in detail which are usually applied to the software application during the early software testing phase.


⇓ Subscribe Us ⇓


If you are not a regular reader of this website then highly recommends you Sign up for our free email newsletter!! Sign up just providing your email address below:

Enter your email address:

Check email in your inbox for confirmation to get latest updates Software Testing for free.

Happy Testing!!!

Leave a Comment

Share This Post