What is difference between Unit Testing and Integration Testing?

In Software Development Life Cycle, normally software application does not developed by a single developer. The software application is divided into different modules and modules are allocated to different development teams. When a module is developed by developer and it is tested for functionality then it is known as Unit testing. Once all modules are developed and integrated with other modules then Integration testing is to be carried out to discover the issues arise when different modules are interacting with each other to build overall system.

Q. What is difference between Unit Testing and Integration Testing?

Unit Testing vs Integration Testing
Unit TestingIntegration Testing
Unit testing is a type of testing to check if the small piece of code is doing what it is suppose to do.Integration testing is a type of testing to check if different pieces of the modules are working together.
Unit testing checks a single component of an application.The behavior of integration modules is considered in the Integration testing.
The scope of Unit testing is narrow, it covers the Unit or small piece of code under test. Therefore while writing a unit test shorter codes are used that target just a single class.The scope of Integration testing is wide, it covers the whole application under test and it requires much more effort to put together.
Unit tests should have no dependencies on code outside the unit tested.Integration testing is dependent on other outside systems like databases, hardware allocated for them etc.
This is first type of testing is to be carried out in Software testing life cycle and generally executed by developer.This type of testing is carried out after Unit testing and before System testing and executed by the testing team.
Unit testing is not further sub divided into different types.Integration testing is further divided into different types as follows:
Top-down Integration, Bottom-Up Integration and so on.
Unit testing is starts with the module specification.Integration testing is starts with the interface specification.
The detailed visibility of the code is comes under Unit testing.The visibility of the integration structure is comes under Integration testing.
Unit testing mainly focus on the testing the functionality of individual units only and does not uncover the issues arises when different modules are interacting with each other.Integration testing is to be carried out to discover the the issues arise when different modules are interacting with each other to build overall system.
The goal of Unit testing is to test the each unit separately and ensure that each unit is working as expected.The goal of Integration testing is to test the combined modules together and ensure that every combined modules are working as expected.
Unit testing comes under White box testing type.Integration testing is comes under both Black box and White box type of testing.

Conclusion:

Integration testing will help to verify the overall system after developing the different modules. When issues observed in the integration test, the unit testing results for specific functionality will help to fix the issue. As a result both Unit testing and Integration testing is equally important. In this we have seen the basic “What is difference between unit testing and integration testing?” I think I have addressed all major differences in this article.

To get software testing articles in your inbox click here to Subscribe with your email address or add you email address below.


⇓ Subscribe Us ⇓


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


 

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


  Happy Testing!!!
 

9 thoughts on “What is difference between Unit Testing and Integration Testing?”

  1. Article is very helpful. Before writing this article I was bit confused about terms, however now I am clear about the terms Unit Testing and Integration Testing.

    Thanks a lot,
    Preeti Oza

    Reply
  2. What are the differences among below? Kindly explain with an example.

    1. Unit Testing
    2. Functional Unit Testing
    3. Component Testing

    Reply

Leave a Comment

Share This Post