Software quality assurance: module tests
Module tests, often referred to as unit tests or component tests, are used to check the individual components of computer programs. With these tests, you can examine whether individual parts are functioning correctly before they are properly integrated into the overall software concept. These tests are useful, as they enable you to quickly and easily check whether the components are working as the developer intended them to. Module tests are one of the most effective ways to detect as many errors as possible in the earlier stages of the program code.
In general, module tests play an important role in the quality assurance of software. This method is particularly used in agile software development, where the goal is to carry out a lot of component tests. This is also the reason they are performed automatically. Corresponding programs can execute a number of module tests at the push of a button. Usually, the test program that’s used is written in the same language as the test object itself.
What are module tests used for?
You often hear unit tests being mentioned, since the smallest units of the software are checked. And it just so happens that the smallest units are, in fact, the modules.
It is advisable to check for errors early on in the software development process, since they can be quickly and cost-effectively rectified in the module test phase. In later phases, rectifying these mistakes can prove costly. Module tests primarily deal with functional properties. Typically, the developer performs the tests himself and ensures that all the functions are working correctly.
Test environments with module tests
An important feature of module tests is their ability to be isolated. This test performs a specific function, while all external influences, such as communication with other systems, are excluded. Since interactions with other components are left out, it is possible to clearly identify any errors that might occur in the isolated module.
Modules are tested in a standalone environment. This special test environment has to be created first, which can turn out to be a relatively complex and very time-consuming process. Since a module is not self-executable, a 'test harness' is needed in order to perform the testing. The test object can only form an executable program with this test harness in place. In order to create a realistic test environment, stubs are used to serve as place holders for when the module (to be tested) requires other components to interact with it.
Test frameworks for module tests
The goal of module tests is to detect errors within individual components. If you want to ensure that a code is correct over the entire development period, you have to constantly run unit tests. Here, automation is key.
There are special software test frameworks that are used to perform module tests. Suitable module test software is available for almost all programming languages. It reads the source code and checks for errors. The test environment described above produces the tools automatically, and the developer focuses on defining the test cases.
A detailed list of available test frameworks for individual programming languages can be found here.