Skip to main content

Editor: Test scripts

Function: The test script editor provides the implementation of the test run. The top node is always the Test scripts test element. At least one Test case test element is below that. The button bar above the test script tree provides options for editing and executing the test script.

Call: In the Test Manager view, on the Test scripts tab, select a test script.

Table 77. Button bar
_tm_icon_save.png

Saves changes, which you have made in the test script editor or in the test element editor, to the test repository

_tm_icon_pin.png, _tm_icon_pin_set.png

Sets a pin at the current contents of the test script (_tm_icon_pin_set.png)

As soon as a change is made to the script, the pin is automatically removed _tm_icon_pin.png). As a result, the set pin is used as an indicator that the script has not been changed.

The test report contains the information as to whether or not a pin is set for all scripts and the called subscripts.

The pin is stored in the test repository as part of the test script and is retained during export or import.

_tm_icon_run.png

Saves changes in the test repository, you have made in the test script editor or test element editor, and then starts the test run

To do this, the Execute Test dialog opens first. There you can specify a tester name. The test run is started when you click Start to exit the dialog.

_tm_icon_debug_run_continue.png

Saves changes in the test repository, which you have made in the test script editor or test element editor, and then starts the test run in debug mode

For this, the Test progress opens in debug mode and with the status Halted. Halt on error is enabled.

_tm_icon_debug_collapse.png

Expands and collapses an additional node in the tree each time the button is clicked

_tm_icon_expand_bp.png

Expands all nodes with a set breakpoint

Input field

Offline mode: The test script is scanned for the string given here.

The detected locations are marked in the test script tree.



Test script tree

Implementation of the test run with test elements

For this, use the commands in the Test Manager menu.

Commands are also provided in the context menu to comment out test elements in order to exclude them from a debug test run, as well as to set breakpoints.

The top node always contains the Test script test element.

. Other test elements
  • _tm_icon_action.png: Test action

  • _tm_icon_assignment.png: Assignment

  • _tm_icon_call.png: Call

  • _tm_icon_choose.png: Choose

  • _tm_icon_iec_unit_test.png: IEC unit test

  • _tm_icon_remote_call.png: Remote call

  • _tm_icon_test_case.png: Test case

Example:

Double-click the Examples.CounterTest test script in the default test repository to open the following test script in the editor.

_tm_img_test_script.png

Tip

A test script is displayed hierarchically in a folder structure in the Test Manager view. This corresponds to storage in the test repository. As a result, you need to specify its path when accessing the test script. The path contains the hierarchical folders, each separated by a period, and then the test script name.

Tip

Changes in the test script editor are stored for the following actions:

  • Button _tm_icon_save.png: Save the test script.

  • Button _tm_icon_run.png: Save the test script and start the test run.

  • Button _tm_icon_debug_run_continue.png: Save the test script and start debugging the test script.

The File → Save Project menu command saves the open CODESYS project.

Tip

Note that is it possible to pin a test script to monitor the script for unwanted changes. The script retains the pin until it semantically gets the next change. The information about whether or not a pin is set is also included in the test report, and is retained during the export or import of scripts.