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.
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.
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. |
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.
-
From the LoadRunner Enterprise navigation toolbar, click
and select Test Management (under Testing).
-
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.
-
Click
Upload Scripts, and configure the following settings.
Action
How to
Select scripts -
Click Select Scripts, and navigate to the directory where the scripts you want to upload are stored.
-
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:
-
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.
-
-
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.
-
-
-
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.
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.
-
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.
-
From the LoadRunner Enterprise navigation toolbar, click
and select Download Applications (under More Tools).
-
Select VuGen Script Converter and click Download.
-
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.
-
-
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.
View script details
You can view details of scripts uploaded to LoadRunner Enterprise from the script details page.
-
From the LoadRunner Enterprise navigation toolbar, click
and select Test Management (under Testing).
-
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.
-
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.
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:
-
From the LoadRunner Enterprise navigation toolbar, click
and select Test Management (under Testing).
-
Click a script in the Test Management tree. The script details page opens.
-
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).
-
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.
-
-
Click
in the Description box to add or modify the description for the script.
-
After making changes, click Save.
Edit script parameters
This section describes how to edit parameters in a Vuser script from LoadRunner Enterprise.
Available in LoadRunner Enterprise 2020 SP3: Added the ability to define data assignment behavior for parameters. This controls how parameter values are allocated to Vusers during script execution.
Note:
-
If you edit a parameter, the change will affect 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).
See also: