Unit Test vs Integration Test

     Unit Test vs Integration Test.



    1. What is the Unit Test?

    Unit Tests are conducted by developers and test the unit of code( aka module, component) he or she developed. It is a testing method by which individual units of source code are tested to determine if they are ready to use. It helps to reduce the cost of bug fixes since the bugs are identified during the early phases of the development lifecycle.

    2. What is Integration Test?

    Integration testing is executed by testers and tests integration between software modules. It is a software testing technique where individual units of a program are combined and tested as a group. Test stubs and test drivers are used to assist in Integration Testing. Integration test is performed in two way, they are a bottom-up method and the top-down method.

    3. Difference Between Unit Test and Integration Test

    Unit test

    Integration test

    The idea behind Unit Testing is to test each part of the program and show that the individual parts are correct.

    The idea behind Integration
    Testing is to combine modules in the application and test as a group to see that they are working fine

    It is kind of White Box Testing

    It is kind of Black Box Testing

    It can be performed at any time

    It usually carried out after Unit Testing and before System Testing

    Unit Testing tests only the functionality of the units themselves and may not catch integration errors, or other system-wide issues

    Integrating testing may detect errors when modules are integrated to build the overall system

    It starts with the module specification

    It starts with the interface specification

    It pays attention to the behavior of single modules

    It pays attention to integration among modules

    Unit test does not verify whether your code works with external dependencies correctly.

    Integration tests verify that your code works with external dependencies correctly.

    It is usually executed by the developer

    It is usually executed by a test team

    Finding errors is easy

    Finding errors is difficult

    Maintenance of unit test is cheap

    Maintenance of integration test is expensive