Scripts

This topic provides an overview of how to create scripts and upload them to LoadRunner Enterprise to run your performance tests.

Vuser scripts overview

When you run a performance test, virtual users (Vusers) access your application concurrently in order to put load on your server. The actual steps that the Vusers perform when accessing your application are represented in a Vuser script. Each Vuser performs the actions recorded in one Vuser script.

You design Vuser scripts to emulate typical end-user activities on your application. For example, if you are testing performance on a Web site, the Vuser script emulates a real user accessing URLs, clicking links, submitting forms, and so on. When you create a performance test, you distribute your Vuser scripts among your Vusers.

Example: In the case of testing a Web site, you can specify that a portion of the Vusers run a Vuser script that emulates real users accessing your home page, a portion run a script that performs a search query, and a portion emulate the completion of an order form.

Supported environments

In addition to testing Web sites, LoadRunner Enterprise can be used to test performance of non-Web environments. For example, you can test Citrix, MQTT, or Oracle NCA applications. For details of supported protocols, see the Virtual User Generator Help Center.

Back to top

Create a script

A script is the recorded actions of a business process in your application. Your load test can contain one or more scripts.

The following table lists the tools you can use to create scripts for your load tests.

Script Tool Description
VuGen

Virtual User Generator (VuGen) is Micro Focus's tool for creating testing scripts that emulate the behavior of real users on your system. For details, see, VuGen scripts.

JMeter

Apache JMeter is an open source performance testing tool. For details, see JMeter scripts.

LoadRunner Developer (DevWeb)

LoadRunner Developer is Micro Focus's new protocol offering, focusing on the HTTP (transport) level. It provides a lightweight, scalable, cross-platform solution using a brand new JavaScript SDK and engine. For details, see DevWeb scripts.

Gatling

Gatling is an open-source load testing framework based on Scala, Akka, and Netty. For details, see Gatling scripts.

UFT Developer

UFT Developer is Micro Focus's powerful and lightweight functional testing solution. For details, see UFT Developer tests.

UFT One

UFT One is Micro Focus's comprehensive solution for functional test and regression test automation, combined with functional testing for headless systems. For details, see UFT One tests.

NUnit

NUnit is an open-source unit testing framework for the .NET Framework. For details, see NUnit tests.

JUnit, Selenium

JUnit and Selenium are open source performance testing tools. For details, see JUnit and Selenium tests.

Back to top

Upload a script

Upload the scripts you want to use in your tests to LoadRunner Enterprise from the LoadRunner Enterprise user interface. You can upload up to 20 scripts simultaneously.

Tip: You can also upload VuGen, JMeter, DevWeb, Gatling, and UFT One GUI and API test scripts to LoadRunner Enterprise from the LoadRunner Enterprise REST API. For details, see Scripts in the LoadRunner Enterprise REST API Guide.

  1. From the LoadRunner Enterprise navigation toolbar, click and select Test Management (under Testing).

  2. In the test management tree, select a destination folder for the scripts, or create a new folder.

    Note: The folder name must not contain a forward slash (/). Either rename the folder so that it does not contain a forward slash (/) or upload scripts directly from VuGen.

  3. Click Upload Scripts, and configure the following settings.

    Action

    How to

    Select scripts
    1. Click Select Scripts, and navigate to the directory where the scripts you want to upload are stored.

    2. Select the scripts to upload and click Open.

    Note:

    • The scripts must be saved locally, must be in ZIP format, and must include all the files in the test scripts folder.

    • The file path inside a script folder must not exceed 260 characters.

    Configure upload settings

    Configure the following upload settings:

    1. Select the action to take if the script already exists in the destination folder:

      • Auto rename. Automatically gives the script a different name.

      • Overwrite existing script. Overwrites the existing script.

    2. Select the method to use for uploading the script:

      • All files. Uploads all the files contained in the .zip file. With this option the upload takes a long time.

      • Runtime files only. Only the run time files—that is the scripts, runtime settings, parameters, and so on—are uploaded.

  4. Click Upload to upload the selected scripts to the specified destination folder. The upload status is displayed for each script.

    If scripts fail to upload, you can click to upload a selected script or click Upload All Scripts. Alternatively, click Clear and Add Scripts to remove all the selected scripts, and try to add them again.

Back to top

Convert tests based on NUnit and JUnit to VuGen scripts

Before you can run tests based on NUnit and JUnit in LoadRunner Enterprise, you must install the VuGen Script Converter and then convert them to VuGen scripts.

  1. Download the VuGen Script Converter.

    The converter must be installed on a machine that has the same NUnit or JUnit Framework installed as the one used when creating the test.

    1. From the LoadRunner Enterprise navigation toolbar, click and select Download Applications (under More Tools).

    2. Select VuGen Script Converter and click Download.

    3. Install the script converter and run VuGenScriptConverter.exe.

    Note: VuGen Script Converter can be run from LoadRunner Enterprise host machine. To do so, select Start > All Programs > LoadRunner > Tools > VuGen Script Converter.

  2. Convert the test to a VuGen script.

    You can convert a test to a VuGen script using the script converter, or convert it automatically from a command prompt.

Back to top

View script details

You can view details of scripts uploaded to LoadRunner Enterprise from the script details page.

  1. From the LoadRunner Enterprise navigation toolbar, click and select Test Management (under Testing).

  2. Click a script in the test management tree to display the script details in the right pane. You can also search or filter the tree for scripts:

    Action How to
    Search for scripts

    Click to search for scripts by name. Type the name (or part of the name) in the search box. LoadRunner Enterprise displays all scripts that contain the search string.

    Filter the tree for scripts

    Click the Filter dropdown and select Script to display scripts only.

    Select All to display all LoadRunner Enterprise tests and scripts.

  3. You can perform the following actions from the script details page:

    Action

    How to

    Preview a script

    You can view the following details about a script in the Script Details tab:

    • Script Name. The name of the script.

    • Type. The script type selected.

    • Last Update. The date and time that the script was last updated.

    • Actions. Each Vuser script contains at least three sections: vuser_init, one or more Action sections, and vuser_end. For details of script sections, see Vuser Script Sections in the Virtual User Generator Help Center.

    • Included Files. A list of other files include with the script.

    Edit a script or script parameters

    See Edit a script or Edit script parameters below.

    View related tests

    Click the Related Tests tab to view details of all tests in which the currently selected script is used.

    Click the ID link to open the related test in the Performance Test Designer window. For details, see Performance Test Designer.

    View script attachments

    Click the Attachments tab to view or add attachments that provide additional information about the currently selected test. For details, see Manage test attachments.

    Download the script Click Download to download the script to the Downloads folder of the client user.

Tip: You can also view details of a script by clicking the View Script button in the Performance Test Designer > Groups and Workload tab.

Back to top

Edit a script

This section describes how to view and edit a Vuser script directly from within the LoadRunner Enterprise user interface.

Note:  

  • A user with Viewer role cannot edit a script.

  • All protocols can be edited except for .NET, TruClient Web, TruClient Mobile Web, and TruClient Native Mobile.

To edit a script:

  1. From the LoadRunner Enterprise navigation toolbar, click and select Test Management (under Testing).

  2. Click a script in the Test Management tree. The script details page opens.

  3. Select the action that you want to modify and click Edit Script.

    Note: A script is locked if the script is being edited by another user (Edit Script is not available).

  4. Make changes in the script action as required.

    • You can use the auto-complete feature to select functions.

    • Use the context menu to cut, copy, or change all occurrences. It also includes a Command Palette which provides frequently used functionality, such as sorting, changing the syntax and changing the indentation settings.

  5. Click in the Description box to add or modify the description for the script.

  6. After making changes, click Save.

Back to top

Edit script parameters

This section describes how to edit parameters in a Vuser script from LoadRunner Enterprise.

Note:  

  • If you edit a parameter, the change will affect every performance test in the current project that uses the script.

  • If there are no parameters of File type in the script, an empty dialog box opens.

  • The parameters table is limited to displaying a maximum of 1000 rows or columns, and a file size of 2 MB. If these limits are exceeded, you must use VuGen for editing the parameter file.

  • Parameters can take a while to open and edit if they have a large number of rows and columns (above 100).

To edit a parameter:

  1. From the LoadRunner Enterprise navigation toolbar, click and select Test Management (under Testing).

  2. Click a script in the Test Management tree. The script details page opens.

  3. Select an action and click Edit Parameters.

  4. Select the script parameters you want to edit and modify as required.

    Note: For Gatling and JMeter scripts, and specific VuGen script protocols (those that do not have the <protocol name>.prm file in the \Scripts\Parameters\<protocol name> folder), the Parameters dialog box only allows you to add/delete rows and columns and enter parameter values. You cannot define data assignment behavior for a specific parameter.

    • Parameter window - left pane

      The left pane of the Parameters window is where you select a parameter file and parameter. The toolbar options (New/Rename/Delete Parameter File) are not currently supported.

    • Parameter window - central pane

      The center workspace displays a table where you can manage the values for the parameters in the parameter file. Here you can add rows and columns to the table, and type parameter values directly into the table cells.

      Action Description
      Select Column

      Displayed when a parameter is selected in the left pane of the Parameters window.

      New parameters are, by default, associated with the first column in the data table. To associate the parameter with a different column, click anywhere in the relevant column and click Select Column. This overwrites any previous values associated with the parameter.

      When a parameter name is selected, the associated column is displayed with a blue line across the top of the column.

      Add Row/ Add Column

      Adds an additional row or column. For new columns, you define a column name.

      A page can hold up to 100 rows, and new pages are created automatically if the table passes the page limit. Use the arrows beside the page number at the bottom of the Parameters window to scroll through the pages.

      Tip: You can use CTRL+c and CTRL+v to copy and paste multiple rows or columns.

      In the central pane, you can add additional rows and columns of data.

      Delete Row(s)/Delete Column(s)

      Deletes the selected rows or columns. Select cells anywhere in the table to delete the entire rows or columns that contain those cells.

      If there are multiple pages of tables, selected columns are deleted from all pages.

    • Parameter window - right pane

      The right pane of the parameter window enables you to define data assignment behavior for a specific parameter. These behavior settings control how parameter values are allocated to Vusers during script execution.

      The pane is displayed when a parameter is selected in the left pane.

      UI Element Description
      Next row selection

      Defines the method for assigning each row of data to each Vuser. You can select a specific method, or define that the parameter use the same method and behavior as another parameter associated with the script (including parameters in different data files).

      The available methods are Random, Sequential, and Unique. For information on these methods, see Data assignment methods for parameters.

      Update value on

      Defines the update method to be used with the Next row selection method. For information on the methods, see Data assignment and update methods for file parameters.

      This field is disabled if the Next row selection field is set to use Same as <x parameter>.

      When out of values Enabled when the selection method is Unique. This field defines what to do when there is no more unique data. Currently, the only supported option is Continue in a cyclic manner.
      Vuser values allocation

      Enabled when the selection method is Unique, and update method is on Each occurrence or Each iteration.

      Use the radio buttons to indicate how to allocate data blocks of parameter values to the Vusers:

      • Automatically allocate block size. Controller will automatically allocate the block size, calculated by dividing the number of parameter values by the number of Vusers. (This option is disabled if the update method is Each occurrence.)

      • Allocate values for each Vuser. Directly under this option, specify the block size (number of values) to allocate to each Vuser.

Back to top

See also: