What is a unit test

Module test

In the unit test (also called module test or component test), the individual modules of a software are tested. Modules are the smallest testable parts of software and can or should be checked very early in the development process. Correcting errors in the unit test phase is very inexpensive compared to correcting errors in later phases. Module or unit tests are typically written and executed by the developer himself.

The aim of the unit test is to test the individual modules in isolation from the other modules and to check that they are correct.
One of the main advantages of unit testing is testing "closer to the failure". This speeds up and simplifies the process of finding errors. Debugging is made easier for the same reason - that is, by restricting the possible sources of error to a small and manageable code area.

Test frameworks are used in order to be able to test the individual modules in an automatic approach in isolation.
During the test execution, the tests are logged by the framework.

The completeness of the unit tests must be checked by means of test coverage or code coverage measurements. Test coverage analyzers such as Testwell CTC ++ are used for this. Testwell CTC ++ can be used with any unit test tool.

During the unit test "only" the individual modules are tested. Errors during the integration or errors in the overall system are not covered by the module tests. For this reason, unit tests must be combined with other test activities.

Seminar Efficient Unit Tests for Embedded Systems