Skip to main content

Editor: Test script editor

Function: In the test script editor, you implement the test run of a test script with test elements. The editor shows the test script as a tree. The top node is always the Test Script test element, followed by at least one test case.

Call: Double-click a test script in the Test Manager view, Test Scripts tab

The editor consists of the following areas:

  • Toolbar with buttons and search field

  • Test script tree with the test elements

  • Description field below the test script tree: Comment for the selected test element. The field is active only if the test element can have a comment.

  • Test element configurator next to the test script tree: Tabs with the settings of the selected test element

Table 11. Button bar

_tm_icon_save_script.png

Saves the test script in the test repository

_tm_icon_pin_set.png

_tm_icon_pin.png

Sets or removes the pin and saves the test script

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

_tm_icon_pin_set.png: Pin set

The set pin indicates that the script has not been changed.

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

_tm_icon_pin.png: No pin set

As soon as a change is made to the script, the pin is automatically removed.

_tm_icon_run_script.png

Saves the test script and executes it like the Execute Script command.

_tm_icon_debug_script.png

Saves the test script and executes it in debug mode like the Debug Script command.

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

This opens the Test Progress dialog in debug mode with the status Halted. The Halt on Error setting is enabled.

_tm_icon_debug_collapse.png

Each click switches to the next display:

  1. All branches of the Choose test elements are expanded and selected.

  2. All nodes are expanded.

  3. The original display is restored.

_tm_icon_expand_bp.png

Expands all nodes with a set breakpoint and selects them

Search field

Enter a search term and press the Enter key. All test elements whose name or comment contains the search term are expanded and selected. There is no case sensitivity.

Display detail columns

Shows or hides a second column in the test script tree. The button shows a list box with the following options:

  • None (default): The test script tree does not have a second column.

  • Comments: The second column shows the comment of the test element from the description field below the test script tree. Text that is wider than the column ends with an ellipsis.

  • Test Actions: For test actions, the second column shows the test driver and the action in the format <test driver>.<action> – for example TestManager.Monitoring.ReadVariable. For other test elements, the column is empty.

When you close the test script editor, the None option applies again.



For more information, see the following: Tab: Test Scripts, Execute Script, Debug Script, Test Progress, Commands on the Test Scripts tab, and Test Elements

Test script tree

Implementation of the test run with test elements

You build the test run in the test script tree. The commands for this are located in the context menu of a test element:

  • Insert or add test elements: Test Case, Action, Assignment, Call, Remote Call, Choose, Branch

    Insert …: Inserts the test element above the selected test element.

    Add …: Adds the test element at the end of the selected test element.

  • Comment out / uncomment: Excludes a test element from execution

  • Toggle Breakpoint and Switch Breakpoint Activation: Breakpoints for debug mode

The top node always contains the Test Script test element.

. Other test elements
  • _tm_icon_test_porgress.png: Test case

  • _tm_icon_action.png: Test action

  • _tm_icon_assignment.png: Assignment

  • _tm_icon_call.png: Call

  • _tm_icon_choose.png: Choose

  • _tm_icon_remote_call.png: Remote call

  • _tm_icon_iec_unit_test.png: IEC unit test

When you select a test element, the test element configurator shows its settings on tabs. You edit the comment in the description field below the test script tree.

Saving

The following toolbar icons save the test script in the test repository: _tm_icon_save_script.png, _tm_icon_pin_set.png, _tm_icon_run_script.png, and _tm_icon_debug_script.png. This overwrites the open version.

If you have changed the name or version of the test script, then a prompt is displayed when you save:

Rename the test script

Saves the test script under the new name or the new version. The original test script is deleted.

Copy the test script

Saves the test script under the new name or the new version. The original test script is retained.

Don't save the changes.

Cancels the save operation

To create a new version of a test script, change the version and select Copy the test script.

If you close the editor with unsaved changes, then you can save the changes, keep the editor open, or close the editor without saving.

Important

You cannot save test scripts without a valid license for the CODESYS Test Manager.

Tip

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