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
Debug Script.However, if you select
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.
Stepping in debug mode
In the Test Manager view, below Test Scripts, select the desired test script.
The test script is selected.
In the context menu, click the
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.
Select or clear the
Auto Collapse,
Auto Scroll, and
Halt on Error options according to your requirements.Click the
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:
(successful) CloseProjectIf 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.
Control the execution of the test script with the
and
buttons.The status bar at the bottom of the dialog shows the current state of the test processing.
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.
Click Save as HTML.
The test report is saved in the report directory. This is confirmed in Messages and the file path is output.