Lesson 3: Replaying Your Vuser Script

In the previous lessons, you recorded a set of typical user actions, and prepared the script for replay.

Before replaying the script, you can configure the runtime settings for the script, which define the behavior of the Vuser.

Note: After recording a script on the local WebTours demo application with Web-based protocols, script replay might fail if you are using a proxy. This can happen if your proxy does not support bypassing local addresses (as WebTours is installed on a local host). To solve this, in the runtime settings Proxy view, configure to work with no proxy.

In this lesson you will cover the following topics:

How do I set the Vuser's runtime behavior?

LoadRunner runtime settings let you emulate different kinds of user activity and behavior. For example, you could emulate a user who responds immediately to output from the server, or a user who stops and thinks before each response. You can also configure runtime settings to specify how many times the Vuser should repeat a set of actions in the Vuser script.

There are general runtime settings, and settings that are specific to certain Vuser protocols only. For example, for a Web emulation, you could instruct your Vusers to replay your script in Firefox, Chrome, or Internet Explorer. Runtime settings for specific protocols will be covered in Lesson 4: Preparing a Vuser Script for Load Testing. This lesson describes some of the general runtime settings—settings that apply to all Vuser protocols. The General runtime settings include:

  • Run Logic. The number of times that a Vuser repeats various sections of the Vuser script.
  • Pacing. The time to wait between repetitions.
  • Think Time. The time the Vuser stops to think between steps in the script.
  • Log. The level of information that you want to gather during playback.

Note: This lesson describes how to use VuGen to modify the runtime settings. A later lesson describes how to use the LoadRunner Controller to modify the runtime settings.

To configure the runtime settings:

  1. Open the Vuser script that you saved in the previous lesson.
  2. Open the Runtime Settings view.

    Click Replay > Runtime Settings or press F4. The Runtime Settings view opens in the VuGen editor.

  3. Set the Run Logic settings.

    In the left pane, under General, click Run Logic.

    The Run Logic settings enable you to set the number of iterations for the Vuser script. This is the number of times to repeat the Action section of the Vuser script when the script is replayed.

    Set the Number of iterations to 2.

  4. Set the Pacing settings.

    In the left pane, under General, click Pacing.

    The Pacing settings enable you to control the time between iterations. You will specify a random time. This accurately emulates a real-life setting where the user waits between actions, but at random intervals. For example, you do not see real users always waiting exactly 60 seconds between repeated actions.

    Select the third radio button, and select the following:

    Start new iteration at Random intervals, every 60.000 to 90.000 second(s).

  5. Set the Log settings.

    In the left pane, under General, select Log.

    The Log settings indicate how much information to log while running the Vuser Script. While developing a Vuser script, you may want to enable some logging for debugging purposes, but once you verify that your script is functional, you can enable logging for errors only, or even disable logging.

    Select Extended log and enable Parameter substitution. This option will be relevant for the following lesson at which point it will be discussed.

  6. View the Think Time settings.

    In the left pane, under General, click Think Time.

    Keep the default think time setting - Ignore think time. You will set the think time from the Controller. Keep in mind that when you run the script in VuGen, it will run quickly since it will not include think time.

Back to top

How do I run my Vuser Script?

After recording the Vuser script and setting the runtime settings, you are ready to run the script.

To run a Vuser script:

  1. Open the Vuser script in VuGen.
  2. Click Replay > Run or click the Replay button on the VuGen toolbar.

 

VuGen provides a number of indicators that your script is running.

  1. The message "Running" appears in the lower left corner of VuGen.
  2. A yellow marker appears in the Editor and indicates the specific line that is being replayed.
  3. The Step Navigator pane indicates the step that is being replayed.
  4. The Output pane displays messages as the replay progresses.

Back to top

Where can I view information about the replay?

Replay Summary

When the Vuser script stops running, you can view a summary of the replay. The summary opens in the <Script Name>: Replay Summary tab.

The Replay Summary tab shows:

  • Whether the script replay was successful or failed.

  • Basic information about the script run, such as the duration of the replay, and the start and end times of the replay.
  • A summary of the actions and transactions that were performed during the script replay. You can click the link embedded inside any of the actions or transactions in order to show additional details.

    Note: If a summary of the actions and transactions does not appear, select Tools > Options > Scripting > Replay > Collect replay statistics, and then replay the script again.

  • A summary of the replay statistics, such as the total throughput during the script replay.

Output Pane

The Output pane shows the Replay log, a list of the events that occurred during the replay of the script. The Replay log uses color-coding to display a textual summary of the events that occurred during the replay.

In this section of the tutorial, you will open the Output pane and locate specific events and notifications within the Replay log.

To view the Replay log:

  1. After replaying the script, the Output pane usually opens. If it is not open, click View > Output or click the Output button on the VuGen toolbar.
  2. Make sure that Replay is selected in the Output pane.

  3. From the VuGen menus, click Search > Quick Find to open the Search dialog box.
  4. From Scope, select Current Script.
  5. Click Include in search, and then select the Logs check box.
  6. Locate the following items in the Replay log, by entering the following text into the Find text field:
    1. "Virtual User Script Started" - the beginning of the script run.

    2. "Vuser Terminated" - the end of the script run.
    3. "iteration" - the beginning and the end of each iteration and the iteration number. (This text appears in orange lettering.)

      Note: The Output pane displays successful steps in green and errors in red. For example, if the Vuser was unable to connect to the server, the Output pane would display the error text in red, and indicate the line number in the script where the error occurred.

      Tip: If you double-click a line in the Output pane, VuGen shows the corresponding step in the VuGen script editor.

Back to top

Next steps: