Skip to main content

Debugging a Test Script

Tip

The debugging functionality is not supported in test scripts which are called externally (for example, in another CODESYS instance).

Tip

The following applies for the status "Commented Out" of script elements and for set breakpoints:

  • They only have an effect on Debug Script, not on the ordinary Execute Script.

  • They are not stored in the test script / repository, but in the user options so that they exist only for the respective user and do not bother other editors/PCs.

Commands for debugging of test scripts are located in the Test progress dialog. A script can be processed in single steps. In doing so, you can monitor variables of the current scope and view the previous errors. Before executing the script, you can exclude individual elements of the script from processing in debug mode by commenting them out and setting breakpoints. Breakpoints can be disabled temporarily and, for example, used as bookmarks.

Stepping in debug mode

  1. In the Test scripts view, select the script that you want to debug.

  2. In the context menu or in the Test Manager menu, click _tm_icon_debug_script.png Debug Script.

    The Test progress dialog opens. The status Halted is displayed in the status bar. Halt on error is enabled.

  3. Set the desired behavior as needed by means of the Auto collapse, Auto scroll, and Halt on error buttons.

  4. Click the _tm_icon_debug_run_continue.png button to execute the next test element in the script and halt again afterwards.

    The status changes to Stepping for the duration of the processing. A line is displayed in the view with the contents of the processing. The result of the processing step is indicated at the beginning of the line in parentheses. Example: _tm_icon_action.png(successful) CloseProject

    If errors occur, then the error messages are displayed on the Errors tab of the dialog. You can copy the error messages from there to the clipboard (Ctrl+C).

    On the Variables (scope #<id>) tab, you can view the variables affected in the test step, including their parameters, values, and scope. For example, when you switch from an action to a call while stepping, the scope also changes.

  5. Click the _tm_icon_run.png button if you want to run the test script without halting (continue), or click the _tm_icon_debug_stop.png button to halt before executing the next test element. The current status of the test processing is always displayed in the lower left in the status of the dialog.

  6. When the test script is processed completely, the Test progress dialog closes. The test report is opened in its own window and added to the Reports view.