Normally a software application is developed by a team of many people. So while developing an application is divided into different modules and modules are divided to different developers of team. When a single developer write some code, let’s say a common function, and test that function then this type of testing is called Unit Testing. When all the different modules are developed and integrated then testing is required to check if the complete application is working properly or not after integrating different modules, This type of testing is called Integration Testing.
Difference between Unit Testing and Integration Testing:
- Unit testing is a type of testing to check if the small piece of code or a single function is doing as per the expectation.
- It checks a single component/function of the application.
- Its scope is very limited.
- It should have no dependencies on code outside its definition.
- This is the first type of testing is to be carried out in the Software testing life cycle and generally executed by the developer.
- The goal of Unit testing is to test each unit separately and ensure that each unit is working as expected.
- Unit testing comes under the White box testing type.
- Integration testing is a type of testing to check if different modules are working as expected after integrating each other.
- It checks the overall flow of the application. after the integration of different modules.
- Its scope is very wide
- This type of testing can have each every element in the software application
- This is performed after unit testing. Generally, the script is preferred to test the integration testing
- Integration testing is further divided into different types as follows: Top-down Integration, Bottom-Up Integration, etc
- Integration testing is coming under both Black box and White box type of testing.
Unit Testing and Integration Testing both are equally important for testing an application. And it's very important to create an application bug-free and work as expected.
Find below the link of the sample application for Integration Testing of Nodejs API: https://jsonworld.com/demo/testing-nodejs-api-with-mocha-and-chai