Difference between unit test, system test, integration test and regression test
Unit tests are carried out on the individual units of a program and are intended to examine an individual component that has been modified or introduced for the first time. Each test that aims to validate a single module must be presented with the related technical documentation attached, which will contain among other information the outputs that the tested module is expected to provide. The unit tests focus on the functionality and reliability of the software and are performed in a test phase prior to system integration. If a defect were discovered during a unit test, its nature and impact on the general system would be assessed; the goal is to resolve it before the tested module is approved.
System test are performed on all new or modified components and modules that characterize a product. The goal is to understand how the different unitary blocks interact with each other and if they provide the required outputs overall; emphasis is placed on validating and verifying system requirements and on how individual modules work together when they are connected. Usually the tests on the system are more than one: the first one deserves special mention (normally called “smoke test”), which aims to study in broad terms how the program behaves and if the main functions are carried out correctly, without dwell on the details. Tests on the entire system take a long time, as it is necessary to carry out a large number in order to analyze all the possible scenarios that may occur; the Test Plan at this juncture plays a very delicate role, because it contains the description of the test cases, the sequence in which they must be performed and the documentation necessary to list the results. When an error is discovered and fixed, the test must be re-performed to ensure that the corrections made have had no negative influence on components that previously had no errors (the regression test already mentioned above).
After having performed the various system tests, it is necessary to make sure that the program developed provides the desired results even if it is run in environments other than the native one: it is therefore necessary to carry out integration tests, in which the product is tested together with other ones interfaces and applications. Unlike system tests, in integration tests it is not necessary to re-test if a defect is discovered after it has been fixed. The integration tests are divided into different groups and can be carried out or not depending on the application to be tested:
- Compatibility test: guarantee that the application works with different configurations based on those available to the user
- Performance tests: they evaluate the ability of the application to function correctly when, for example, multiple users use it simultaneously or the number of inputs increases
- Stress tests: they test the correct functioning of the application when it is stressed with unusual workloads
- Load tests: they are complementary to stress tests and evaluate the operation of the application under normal workloads
The regression test, already mentioned in the previous paragraphs, is carried out whenever the procedure of a program piece is modified following the identification of a defect; when an error is corrected, the possibility arises that a new one is unintentionally introduced: there is therefore the introduction of uncertainty about the application’s ability to repeat all previously performed functions correctly again. The regression test is usually carried out in parallel with other tests and can be seen as a quality control to ensure that the code just modified continues to correctly perform the functions that have not been modified and that meets the same requirements verified previously . In conclusion, it can be stated that the regression test ensures that the rest of the application not subject to modification is not affected by errors arising from the correction of others.