Relative Paths for Scripts

You can specify a relative location for a script in your scenario. The location can be relative to the current scenario folder, or relative to the LoadRunner installation folder.
When you run a scenario, the script is automatically copied from this relative location to a temporary folder on the load generator running the script. This enables the load generator to access the script locally instead of over a network.
To specify a path relative to the current scenario director, type either of the following notations at the start of the script path:
Notation
Description
.\
Indicates that the path is relative to the location of the scenario folder
..\
Indicates that the path is relative to the location of the parent folder of the scenario folder
For example, if the current scenario is located at F:\scenarios, to specify that the script, user1, is located in F:\scenarios\scripts, you could type:
.\scripts\user1
To specify a path relative to the LoadRunner installation folder, type a percent sign (%) at the beginning of the script path. For example, if the LoadRunner installation folder is located at F:\LoadRunner, to specify that the script, user1, is located in F:\LoadRunner\scripts, you could type:
%\scripts\user1

How to View/Modify Scripts in the Scenario

This section describes how to view and modify scripts used in your load test scenario.
You view/modify the details of the scripts in the Group Information dialog box (see Group Information Dialog Box) or in the Script Information dialog box (see Script Information Dialog Box).
In this topic:

View script details

You can view the details of a script by right-clicking the script in the Scenario Groups/Scripts pane and selecting Details.
In the Group/Script Information dialog box that opens, you can:
  • View details about the script, including:
  • Note: If you do not see some of the details listed below, click More.
  • Script path
  • Command line options
  • Rendezvous points included in the script
  • Vusers associated with the script
  • Files associated with the script
  • Open the script in VuGen by clicking the View Script button
  • View the script's runtime settings by clicking the Runtime Settings button

Modify a script's runtime settings

  • To view or modify a script's runtime settings, in the Scenario Groups/Scripts pane right-click the script and select Runtime Settings.
  • To view or modify runtime settings of a script associated with a particular Vuser, in the Vusers dialog box (Scenario Groups pane > Vusers ) right-click the Vuser and select Runtime Settings.
  • Modifying the runtime settings for one Vuser in a group modifies the runtime settings for all the Vusers in that group that are using the same script.

Modify multiple scripts' runtime settings

This section describes how to modify runtime settings of multiple scripts or of a Vuser group that includes multiple scripts.
  1. In the Scenario Groups/Scripts pane select multiple scripts or the Vuser group that includes multiple scripts.
  2. Right-click the selection and select Runtime Settings.
  3. In the Multiple runtime settings Mode dialog box that opens:
    • To modify runtime settings for all of the scripts simultaneously, click Shared RTS.
    • To modify runtime settings per script, click Individual RTS.
      For user interface details, see Multiple Runtime Settings Mode Dialog Box.
    • For details about specific runtime settings, see Runtime Settings Overview.
    • When you modify the runtime settings from the Controller, LoadRunner runs the script using the modified settings.

View/Edit a script in VuGen

To view/edit a script included in your scenario, right-click the script and select View Script. The script opens in VuGen. For more information on editing scripts, see the Debugging Overview.

Specify command line options

You can specify command line options to use when running a script.
  1. In the Scenario Groups/Scripts pane, right-click the script and select Details.
  2. In the Group/Script Information dialog box that opens, if Command line is not displayed near the bottom, click More.
  3. Enter a command in the command line, for example: -x value -y value.
    For information about passing command line argument values to a script, see Enhance a Java Script.

View rendezvous points included in the script

  1. In the Scenario Groups/Scripts pane, right-click the script and select Details.
  2. In the Group/Script Information dialog box, if the Rendezvous tab is not displayed near the bottom, click More.
    If there are rendezvous points included in the script, they are displayed in the Rendezvous tab. For details about rendezvous points, see Rendezvous Points Overview.
View Vusers associated with the script
  1. In the Scenario Groups/Scripts pane, right-click the script and select Details.
  2. In the Group/Script Information dialog box, if the Vusers tab is not displayed near the bottom, click More.
    The Vusers tab displays the Vusers associated with the script.

View files associated with the script

  1. In the Scenario Groups/Scripts pane, right-click the script and select Details.
  2. In the Group/Script Information dialog box, if the Files tab is not displayed near the bottom, click More.
  3. By default, the Files tab lists all the files in the script's folder (only after your script has been added to the script list). These files include the configuration settings file, the init, run, and end portions of the script, the parameterization definitions file, and the .usr file. To add a file to the list, click Add.
    Example:  
    To run Visual C++ Vusers on a remote load generator, you must add the .dll of the Vuser to the list of files.
    You can delete the files that you add, but not the other files listed.

How to Change the Scenario Mode (Manual Scenario)

This task describes how to change a manual scenario from Vuser group mode to percentage mode, and vice versa.
For details about the scenario modes and the effects of changing from one to another, see Manual Scenarios.
  • To convert the scenario from Vuser group mode to percentage mode, select Scenario > Convert Scenario to the Percentage Mode.
  • To convert the scenario from percentage mode to Vuser group mode, select Scenario > Convert Scenario to the Vuser Group Mode.
  • Note: By default, every time you convert from one mode to another, a message appears warning you that scenario and schedule settings may change. To show/hide this warning message, select Scenario > Show Convert Scenario Mode Warning.

How to Design a Manual Scenario

This task describes how to design a manual scenario.
In this topic:

1. Prerequisites

  • When designing a manual scenario, plan how you want to distribute the Vusers in the scenario. For more details, see Manual Scenarios.
  • Before you start designing the scenario, record the VuGen scripts that will run in the scenario. For details, see Record a Vuser Script.

2. Open a scenario, or create a new one

  1. On the main Controller toolbar, click the New Scenario button .
  2. In the New Scenario dialog box, select Manual Scenario.
  3. (Optional) To distribute the Vusers by percentage, select the Use the Percentage mode... option.
  4. Note: You can convert from one scenario mode to another at any time. For details, How to Change the Scenario Mode (Manual Scenario).
  5. (Optional) Select scripts to participate in the scenario. If you do not select the scripts here, you can select them later on.
    Note: If a script was created in a version of VuGen or TruClient that is later than the Controller version, the script may not run. In this case you may be prompted whether to allow the script to run. A notice will be put in the Load Generator log.
  6. When you click OK, the scenario opens in the Design tab.
 Back to top

3. Add load generators to the scenario

Click the Load Generators button . In the Load Generators dialog box that opens, click Add and enter the details of the load generator you are adding. For details about adding load generators, see Add New Load Generator/Load Generator Information Dialog Box.

4. Add Vuser groups/scripts to the scenario - Vuser group mode

  1. In the Scenario Groups pane, click the Add Group button .
  2. In the Add Group dialog box:
    • Give the group a name and assign a number of Vusers to the group.
    • Select a load generator on which to run the Vusers.
    • Select a Vuser script.
 Back to top

5. Add Vuser groups/scripts to the scenario - Percentage mode

  1. Click the Add Group button  and select a Vuser script from the list. Repeat this step for all scripts that you want to include inthe test.
  2. In the Scenario Scripts pane's Load Generator column, select load generators on which to run the scripts.
  3. In the Scenario Scripts pane's column, assign a percentage of the total number of Vusers for each script. Assign percentages to the scripts starting with the first script in the table and moving down the list.
 Back to top

6. Define a virtual location for the scenario - optional

If you have Network Virtualization installed, click in the Virtual Location column, and select a location. For details, see Network Virtualization Locations.
 Back to top

7. Define a schedule for the scenario

Define a schedule by which to run the Vusers in the scenario. For details, see How to Define a Schedule for the Scenario.
 Back to top

8. Define service level agreements for the scenario - optional

You can define service level agreements (SLAs) to measure scenario goals over time intervals, or over a whole scenario run. When you later analyze the run using LoadRunner Analysis, this data is compared against the SLAs and SLA statuses are determined for the defined measurements. To define SLAs, see How to Define Service Level Agreements.

How to Design a Goal-Oriented Scenario

This task describes how to design a goal-oriented scenario. In this type of scenario, you define the goals you want your test to achieve and LoadRunner automatically builds a scenario for you based on these goals.
In this topic:

1. Prerequisites

  • Before setting up the scenario, decide which goal you want the scenario to reach. For details on types of scenario goals, see Goals Types for Goal-Oriented Scenarios.
  • Before you start designing the scenario, record the VuGen scripts that will run in the scenario. For details, see Record a Vuser Script.

2. Open a new goal-oriented scenario

  1. On the Controller toolbar, click the New Scenario button .
  2. In the New Scenario dialog box that opens, select Goal-oriented Scenario.
  3. Select scripts to run in the scenario. Select scripts in the Available Scripts box, and click Add to move them to the Scripts in Scenario box.
    Note: If a script was created in a version of VuGen or TruClient that is later than the Controller version, the script may not run. In this case you may be prompted whether to allow the script to run. A notice will be put in the Load Generator log.
  4. When you click OK, the Design tab opens and displays the new scenario.

3. Add load generators to the scenario

Click the Load Generators button . In the Load Generators dialog box that opens, click Add and enter the details of the load generator you are adding. For details about the Add Load Generator dialog box, see Add New Load Generator/Load Generator Information Dialog Box.

4. Assign load generators to each script

In the Scenario Scripts pane, for each script, click the Load Generators column and select a load generator on which to run the script.
Note: By default, the script will run on all the load generators in the scenario.

5. Define a goal for the scenario

In the Scenario Goal pane, click the Edit Scenario Goal button. In the dialog box that opens, define the goal the scenario should reach. For details about filling in the scenario goal details, see Edit Scenario Goal Dialog Box.

6. Define a virtual location for each script in the scenario - optional

In the Scenario Scripts pane's Virtual Location column, select the location for the network virtualization. This only applies if you have Network Virtualization installed. For details, see Network Virtualization Locations.

7. Assign each script a percentage of the total scenario target

In the Scenario Scripts pane's % of Target column, enter the percentage of the total goal you want each script to reach during the scenario.
Note: Assign percentages to the scripts starting with the first script in the list and moving down the list.

8. Define service level agreements for the scenario - optional

You can define service level agreements (SLAs) to measure scenario goals over time intervals, or over a whole scenario run. When you later analyze the run using LoadRunner Analysis, this data is compared against the SLAs and SLA statuses are determined for the defined measurements. To define SLAs, see How to Define Service Level Agreements.

Noise Generators

You can approach Web performance testing in the following ways:
  • Create a load test that runs complex Vuser scripts. These scripts perform a business process and contain transactions, complex flows, checkpoints, and so forth.
  • Create a load on the server by having a large number of users (real or virtual) access the same URL simultaneously. This is commonly known as Noise Testing.
The first approach uses a standard Vuser script generated with VuGen or through a DevOp addin. The script performs the full business process and gathers the metrics. After the test run, you can retrieve meaningful information from the Analysis graphs and reports.
The second approach, noise testing, only allows you to determine the response times and whether the server can handle the load without crashing.
The LoadRunner Controller allows you to set up both types of scenarios. You can create a single scenario that contains both standard and noise generator type Vusers.
You set up a noise generator scenario from the Add Script dialog box. You select a Noise Generator type of script, and specify the URL of the server you want to access. During the scenario run, these Vusers access the URL simultaneously.
You cannot edit Noise Generator scripts in VuGen.

JMeter Best Practices and Troubleshooting

This topic describes best practices and limitations when working with JMeter, and how to troubleshoot issues that may occur.
In this topic:

Graceful shutdown

Generally, JMeter supports shutting down gracefully. This requires appropriate port configuration, and to set the Run until completion option.
If there is a timeout by Controller, JMeter will receive the shutdown gracefully command and stay there for 5 minutes.
Click Stop Now in the Run tab if you want to stop the scenario aggressively.

Best practices

The following are recommended as best practices when working with JMeter tests:
  • We recommend that you use scenario mode (Vuser group mode) when running JMeter scripts. If you do use percentage mode, note how many instances of the JMeter test you will be executing.
  • Before running LoadRunner scenarios, check that your JMeter test can run with the JMeter installation on the load generator.
  • Run a maximum of one .jmx test (using 1 Vuser - default value) per each load generator. If the .jmx test is running a lot of threads, more than one test may overload the system.
  • Let the scripts run to completion.

Limitations

Note the following limitations when working with JMeter in LoadRunner:
  • Service level agreements (SLAs) are not supported for JMeter tests.
  • Network Virtualization is not supported for JMeter tests.
  • JMeter remote testing feature (one JMeter client instance controlling multiple remote node instances) is not supported with LoadRunner.

Troubleshooting JMeter tests

If you have any difficulty running JMeter tests, check if the following can resolve the issue.
Error: Cannot find the JMX file 'C:\jmeter_tests\test.jmx‘.
Possible causes:
  • The file is not present in this location.
  • Not enough disk space to clone the file.
Error: The JMETER_HOME environment variable is not configured.
Resolution: Define the JMETER_HOME environment variable, or add the JMeter path in Runtime Settings.
Error pattern: Message contains “Problem loading XML from: ‘……’ missing class ….
Resolution: The JMeter test may contain 3rd-party plugins, and the plugins are missing in the currently used JMeter instance. Either remove the plugins from the JMeter test file, or add the plugins to the JMeter instance.
Error: Unable to bind to free port (for Shutdown/StopTestNow) in range 4445 - 4455. Please extend the port range in the JMeter Runtime Settings.
Resolution: In Runtime Settings, extend the JMeter port range, or change to default.
There is no data in JMeter graphs in Controller or Analysis.
Resolution:
  • In Runtime Settings, make sure that the Start measurement check box is selected.
Errors: Failed to create a Java virtual machine (JVM); Failed to load the 'jvm.dll/libjvm.so’ library file.
Resolution: Check that Java is properly installed on the machine.
  • For Windows: Check that the folder that contains jvm.dll is included.
  • For Linux: Check that LD_LIBRARY_PATH includes directory of libjvm.so.