Debugging overview
Developing a Vuser script includes the steps shown below. This topic provides an overview of the fifth step, debugging a Vuser script.
After creating a Vuser script, replay the script to verify that the script runs without errors. Using VuGen's debug features, you can identify and resolve errors in your scripts. You can access most of these script debugging features from the VuGen toolbar.
Running a Vuser script
To run a Vuser script until the end of the script or until the next breakpoint, perform one of the following:
- Select Replay > Run.
- Click the Run button on the Vuser toolbar.
- Press F5.
Note: The status of the Vuser script execution appears in the lower left corner of VuGen. The script execution status may be Ready, Running, or Paused.
- To stop a script that is running, click the Stop Replay button on the toolbar.
- To pause a script that is running, click the Pause button on the toolbar.
- To continue running a script that is paused, click the Continue button on the toolbar.
The Run Step by Step command
The Run Step by Step command runs the script one line at a time. This enables you to follow the script execution. The Run Step by Step command starts the script replay, and then and pauses it on the first line of the script, usually in the vuser_init() action.
To run the script step by step, perform one of the following:
- Select Replay > Run Step by Step.
- Click the Run Step by Step button on the VuGen toolbar.
-
Press F10.
Note: The Run Step by Step button is available only while a script is being replayed.
Breakpoints
Breakpoints pause script execution at specified points in the script. This enables you to examine the effects of the script on your application at pre-determined points during script execution.
- For concept details on breakpoints, see Use breakpoints.
- For task details, see Debug scripts with breakpoints.
Bookmarks
When working in Script view, VuGen lets you place bookmarks at various locations within your script. You can navigate between the bookmarks to help analyze and debug your code.
- For task details, see Navigate with bookmarks.
Watching variables
The Watch pane enables you to monitor variables and expressions while a script runs. You can monitor variables and expressions only when execution of a Vuser script is in the Paused state. To display the Watch pane, click View > Debug > Watch. For details on using the Watch pane, see Watch expressions and variables.
Go To commands
- To navigate around a script using breakpoints, you can use the Go To Source command. For details, see Debug scripts with breakpoints.
- To navigate around a script using bookmarks, you can use the Next Bookmark and Previous Bookmark commands. For details, see Navigate with bookmarks.
If you want to examine the Replay log messages for a specific step or function, right-click the step in the Editor and select Go To Step in Replay Log. VuGen places the cursor at the start of the corresponding step in the Output pane's Replay log.
Output pane
The Output pane displays messages that were generated during the replay of your script. For details, see Output pane.
Correlation
To enable some recorded Vuser scripts to replay correctly, it may be necessary to implement correlation. Correlation is used when a recorded script includes a dynamic value (such as a session ID) and therefore cannot be successfully replayed. To resolve this, you convert the dynamic value into a variable—thereby enabling your script to replay successfully. For details, see Correlation overview.