Glossary · Automation software engineering and architecture
Unit test
Also known as: Module test, Unit testing
German: Modultest
In software testing, a unit test is an automated test that checks the behavior of the smallest testable part of a program, such as a function, method or function block, in isolation from its dependencies.
- Software engineering
In one sentence
A unit test automatically checks the smallest testable part of a program, such as a function or function block, in isolation.
Example
A unit test sets the inputs of the tank level function block to 95 percent and checks that the high-level alarm output becomes true.
How it applies
- Engineering: Unit tests are fast and run on every change in the Test pipeline. Unit test frameworks for IEC 61131-3 code make this practice possible in PLC development too.
- Verification: Unit tests are the lowest level of software verification; safety standards require module testing with defined coverage for safety-related software.
- Documentation: Unit tests document intended behavior in executable form. For libraries, well-named unit tests can serve as examples for the reference documentation.
Unit test vs. component test
The terms are often used interchangeably. Some teams use unit test for single functions and Component test for larger units with several modules. The German list term Modultest reflects module-level testing.