Software Testing Practices, Test Methodologies and Test Competency Services


Welcome to the world of Software Testing & Best Test Practices.

All you wanted to know about Software Testing, Test Practices, Test Methodologies and building the Test Competency Services !!


Wednesday, August 8, 2012

Unit Testing Vs Integration Testing


Normally software application is not developed by a single developer; rather it is divided into modules that are allocated to different development teams. When a single developed module or unit of the application is tested it is known as unit testing. Once all the modules are developed, they are integrated into one application. Testing of the entire application is known as integration testing.


Characteristics of Unit Testing


Repetition: Unit testing can be performed again and again as many times as you want.
Consistent: Unit test results are very reliable as you can reproduce the results
Quick: Unit tests usually take less than1/2 a second.
Single Issue: Unit tests concentrate on just one issue at a time.
No external implementation dependencies: Database, network, file system, etc that are not in the memory are not required.


Characteristics of Integration Testing


Slow, Difficult and Not Reproducible: Unlike unit tests, integration tests are time consuming. Re-running the test is not only difficult but it may also not give consistent results. Sometimes getting the test results is also not easy.
External Source Requirements: Integration tests need access to external systems as well as local machine.
Multiple Issues: Integration tests target multiple aspects in the same test. Database integrity, protocols, configurations and system logic are some examples of issues checked by a single integration test.
System Dependent values: Unlike unit tests, integration tests take up values like date, time, machine name, etc from the system.
Uncontrollable elements: Integration tests develop features like threads and random number generators that are not under their control.


Some Major Differences


Both Unit testing and Integration testing are used to check the internal quality of the application, whereas acceptance testing verifies the external quality or business quality. Unit testing checks a single component of an application, whereas integration testing checks if different units can work together as a single application. Therefore while writing a unit test shorter codes are used that target just a single class. On the other hand writing integration tests is a lengthy process. Unit tests help the developer to put individual tasks of an application into different classes. Each class executes just one aspect of functionality which helps in developing the design. Integration tests are not useful for design.


Since unit tests cover only a small part of functionality, their test results confirm the exact part of the application that needs to be fixed. Unit tests only target the proper functioning of individual units and are not helpful to verify the smooth functioning of the entire application. Therefore integration tests are required to check the entire application. When an application does not pass the integration test, the unit test results for that specific part of functionality will help in fixing the issue. Thus both unit testing and integration testing are required; as unit tests target the implementation of  individual components and integration tests target the working of an application as a whole.

No comments: