Skip to main content

Troubleshooting errors during the test run

Important

The debug functionality is supported only for locally executed test scripts. It is not available for remotely called test scripts, for example from another CODESYS instance.

Important

The following applies to commented-out script elements and set breakpoints:

  • They are taken into account when executing _tm_icon_debug_script.png Debug Script.

    However, if you select _tm_icon_run_script.png Execute Script, then breakpoints are ignored and commented-out script elements are executed.

  • Commented-out script elements and set breakpoints are saved user-specifically in the user options. The test script in the test repository is not affected. Therefore, these settings do not affect other users or workstations (PCs).

Commands for debugging a test script are located in Test Progress. 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 in debug mode, you can exclude individual elements of the script from processing by commenting them out and setting breakpoints. Breakpoints can be disabled temporarily and, for example, used as bookmarks.

Procedure. Debugging a Test Script

Stepping in debug mode

  1. In the Test Manager view, below Test Scripts, select the desired test script.

    The test script is selected.

  2. In the context menu, click the _tm_icon_debug_script.png Debug Script command.

    The Test Progress dialog will open. The status Halted is displayed in the status bar. The Halt on Error setting is enabled.

  3. Select or clear the _tm_icon_debug_collapse.png Auto Collapse, _tm_icon_debug_scroll.png Auto Scroll, and _tm_icon_debug_break_on_failures.png Halt on Error options according to your requirements.

  4. Click the _tm_icon_debug_run_continue.png button.

    The next test element is executed. Then execution halts.

    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. From there, you can copy them to the clipboard with Ctrl+C.

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

  5. Control the execution of the test script with the _tm_icon_run.png and _tm_icon_debug_stop.png buttons.

    The status bar at the bottom of the dialog shows the current state of the test processing.

  6. Execute the test script to the end.

    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.

    When execution is complete, the Test Progress dialog is closed. The test report is opened.

  7. Click Save as HTML.

    The test report is saved in the report directory. This is confirmed in Messages and the file path is output.