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, or submitting forms. 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

Script creation tools

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

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

Script Tool Description
Gatling

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

JMeter

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

JUnit

JUnit is an open-source performance testing tool. For details, see JUnit tests.

Kafka

Apache Kafka is an open-source event streaming platform for handling real-time data feeds. For details, see Kafka tests.

LoadRunner Developer (LoadRunner Developer)

LoadRunner Developer is OpenText's 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 LoadRunner Developer tests.

NUnit

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

Selenium

Selenium is an umbrella project for a range of tools and libraries that enable and support the automation of web browsers. For details, see Selenium tests.

Silk Performer OpenText's Silk Performer is a software performance testing tool across web, mobile and enterprise applications. For details, see Silk Performer tests.
UFT Developer

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

UFT One

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

VuGen

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

Back to top

Upload a script to LoadRunner Enterprise

This section describes how to upload the scripts you want to use in your tests to LoadRunner Enterprise from the LoadRunner Enterprise user interface.

Tip: You can also upload VuGen, JMeter, DevWeb, Gatling, Kafka, 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.

To upload a script to LoadRunner Enterprise:

  1.  In the top banner, click the module name or the dropdown arrow and select Test Management > Tests & Scripts.

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

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

  3. Click the Upload script button , and configure the following settings.

    Action

    How to

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

    2. Select the scripts to upload (you can upload up to 20 scripts simultaneously), and click Open.

    Note:

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

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

    • A script cannot be uploaded if its name contains any of the following special characters: ~ ` ! @ # $ % ^ & * ( ) + = < > / \ [ ] " { } : ; ' , ? |

    • Silk Performer scripts cannot be uploaded to LoadRunner Enterprise from the Upload Scripts dialog box; they must be uploaded from Silk Performer.

    Configure upload settings

    You can configure the upload settings.

    1. Click Upload Settings, and 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 or USZ file. With this option the upload takes a long time.

      • Runtime Files Only. Only the run time files are uploaded. This includes:  scripts, runtime settings, and parameters.

    3. (For JMeter scripts only) Select Auto split JMX file to split a .jmx file that contains a number of JMeter groups into a separate .jmx file for each group.

  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, click Upload All Scripts to rerun the upload process for all scripts, or click the Upload Script button to attempt to upload the selected script. Alternatively, click Clear and Add Scripts to remove all the selected scripts, and try to add them again.

Back to top

Create a script in LoadRunner Enterprise

This section explains how to create a script in the LoadRunner Enterprise Web client for DevWeb, Web - HTTP/HTML, C Vuser, and Java Vuser protocols, without having to use an external tool or installation.

To create a script in LoadRunner Enterprise:

  1.  In the top banner, click the module name or the dropdown arrow and select Test Management > Tests & Scripts.

  2. In the test management tree, select a destination folder for the script, or Create a test folder.

  3. Click the New Script button .

  4. Enter a name for the script and select the protocol type: TruClient - Web, DevWeb, Web - HTTP/HTML, C Vuser, or Java Vuser.

    Note: The script name can only contain localized characters that are the same as the operation system locale, and must not include any of the following special characters: | * : ; ! % ? / \ - < > ' & =.

  5. Click Create to add the new script template to the specified folder in the test management tree.

  6. Open the script from the test management tree, or click the script ID in the Tests and Scripts tab. The template for the selected script opens in the Script Editor.

  7. Click Edit Script and create your script by adding arguments and parameters. For details, see Edit a script and Edit script parameters.

To encode sensitive data:

To protect sensitive information in scripts, we recommend encoding passwords and masking text in your script to hide passwords and other confidential text strings.

For details, see Encode passwords and text and Working with Microsoft Azure Key Vault in the Vugen Help Center, and Encode sensitive data in the LoadRunner Developer Help Center.

Back to top

Convert NUnit and JUnit based-tests to VuGen scripts

This section explains how to install the VuGen Script Converter, and then use it convert tests based on NUnit and JUnit to VuGen scripts.

To convert NUnit and JUnit tests 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. In the top banner, click the module name or the dropdown arrow and select Download Applications (under More tools).

    2. Select VuGen Script Converter and click Download.

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

    4. To launch the VuGen Script Converter, run VuGen Script Converter from the Start menu of a LoadRunner Enterprise host machine.
  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

This section describes the script details page which provides details of scripts uploaded to LoadRunner Enterprise.

To view script details:

  1.  In the top banner, click the module name or the dropdown arrow and select Test Management > Tests & Scripts.

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

    Action How to
    Search for scripts

    Click the Search button 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 button and select Script to display scripts only, or the All button 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.

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.  In the top banner, click the module name or the dropdown arrow and select Test Management > Tests & Scripts.

  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. In the Description box, click the Edit button 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:  

  • Only File type parameters are supported and displayed. Other parameter types that are not displayed can be edited in VuGen.
  • If you edit a parameter, the change affects every performance test in the current project that uses the script.

  • 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).

  • For Gatling, JMeter, and specific VuGen script protocols that do not have the <protocol name>.prm file in the \Scripts\Parameters\<protocol name> folder, you can only add or delete rows and columns and enter parameter values. You cannot define data assignment behavior for a specific parameter.

To edit a parameter:

  1.  In the top banner, click the module name or the dropdown arrow and select Test Management > Tests & Scripts.

  2. Click a script in the test management tree. The script details page opens.

  3. Select an action and click the Edit Parameters button .

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

    Pane Description
    Left 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 supported.
    Center

    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.

    • 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, a thick line is displayed across the top of the corresponding column.

    • Add Row/Add Column. Enables you to add additional rows and columns of data. 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.

    • 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.

    Right

    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 runs.

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

    • 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 file-type 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 unavailable 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. The Controller automatically allocates the block size, calculated by dividing the number of parameter values by the number of Vusers. (This option is unavailable if the update method is Each occurrence.)

        Note: Unique parameters with automatic block size is supported only when running scripts using LoadRunner Developer or LoadRunner Cloud. It is not supported running DevWeb scripts from LoadRunner Enterprise.

      • 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: