General
The CODESYS Test Manager is a testing framework for software written in CODESYS. You can use the testing framework to execute automated tests to verify the correctness of software at different test levels. The test is ranked according to the process model of software development, in which each stage of software development is subjected to a test. When you have decided at which level the test is to be performed, you can derive how your test should be implemented.
System test
The aim of a test can be to verify that an application, a library, or a communication connection is functioning correctly. Or you want to use a test to verify that a runtime system or a code generator will work error-free over a long time. In this case, the testee is a system. These kinds of tests are usually ranked as system tests. In the case of a system test, a system is fully tested with respect to both functional and non-functional requirements. The test environment simulates the subsequent production environment and should therefore be as realistic as possible.
Integration test
An integration test (interaction test) checks the collaboration of interdependent components. The test focuses on the interfaces of the components involved. The aim of the test is to verify correct results throughout entire processes.
Unit test
The aim of a test can be to verify that a chunk of code, a code snippet, or a programming unit in IEC language works correctly. In this case, the testee is the code. These kinds of tests are usually ranked as unit tests. A unit test (component test or module test) is at the level of the individual components of the software. The testee is the functionality within individual definable parts of the software (programs, function blocks, methods; and properties). The aim of the test is to verify the technical operability and to get correct professional results (also partial results). Unit tests are usually performed by the software developers themselves (Test Driven Development).
You perform a system test by implementing a test script which performs a test run of test cases and test actions. The corresponding test project contains a compilable application with the system settings of the test system.
You perform a unit test or an integration test by developing a test project which contains the testee and additional code that tests it. You can choose between implementing the test code formally as a test table or programmatically as a test POU or multitest POU. At the same time, you implement a suitable test script which contains the IEC Unit Test element. You may also be able to add test cases with actions. The IEC Unit Test element opens the test project when the test is executed and builds a test application from its code.
In each case, you implement a test as an executable test script together with a test project. Then during the test run, the test cases are executed in the test system, evaluated, and a report is generated from the result.
Basic procedure
Create a test project in CODESYS.
Create a test repository, if necessary.
In the Test Manager, create a test script and program the test script with test elements.
Note: The test script generally works with the contents of the test project. For example, the
DeleteObjects
test driver action needs an object from the test project.
Start the test script in the Test Manager.
You get a report in the respective test repository.
Export the report as an HTML document.
You can open the report in a browser.
Resolve the detected errors.
Tip
You can use command-line commands to call the CODESYS Test Manager from outside of CODESYS. As a result, you can permanently integrate the Test Manager into a system (continuous integration), without starting CODESYS.