Automating the System Test
Examples for the CODESYS Test Manager
Examples of test scripts with CODESYS Test Manager projects are included with the installation of CODESYS Test Manager Examples. See: Example: Test scripts for the Test Manager
Example: Test script Examples.Counter_ApplicationTest
In a test script, you define the flow with test cases. A test case consists of test actions which are provided by test drivers. The test actions cover many functions of CODESYS. You configure the test actions in the test element editor. No special programming knowledge is required for this.
In addition, you can execute IEC unit tests and call IronPython scripts.
An IronPython script which you call in a test script uses the scripting interface of CODESYS. You use IronPython scripts to perform tasks which are not covered by the existing test drivers. In this way, you can automate recurring routine tasks or extend the range of functions of CODESYS Test Manager, for example.
When the test is executed, a test case is counts as passed when all of its test actions are executed without errors. You can configure the error handling for each test case and its test actions.
As a whole, this kind of simple test script is well-suited for performing a system test, although you do not have access to the interfaces of a testee by means of test driver actions.
If you test an application in the system test, then you access the variables of the testee by means of the actions of the TestManager.Monitoring test driver:
ReadVariable: Reads a variableWriteVariable: Writes a variableForceVariable: Forces a variableCompareVariable: Compares a variable with a value
In addition, you can use the ChangeImplementation action of the TestManager.Objects test driver to change the code of the testee.
It is often useful to use the variables at an interface which already exists in the application, for example at the interface to the visualization. It can also be useful to write additional IEC code as a test adaptation. This code stimulates the testee specifically for the test.