Scripts
This topic provides an overview of how to create and upload scripts to run in your performance tests.
Vuser scripts overview
When you run a performance test, virtual users (Vusers) access your application concurrently 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.
In addition to testing Web sites, you can also test the performance of non-Web environments. For example, you can test Citrix, MQTT, or Oracle NCA applications. For details of supported protocols, see the OpenText Virtual User Generator Help Center.
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. |
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. |
OpenText Functional Testing |
OpenText Functional Testing is OpenText's comprehensive solution for functional test and regression test automation, combined with functional testing for headless systems. For details, see OpenText Functional Testing tests. |
OpenText Performance Engineering for Developers |
A tool used to create and run DevWeb protocol scripts which focuses on communication at the HTTP transport level and over WebSocket. It provides a lightweight, scalable, cross-platform solution using a JavaScript SDK and engine. For details, see OpenText Performance Engineering for Developers scripts. |
OpenText Functional Testing for Developers |
OpenText Functional Testing for Developers helps you develop automated tests for a wide range of technologies, using standard IDEs with modern programming languages. For details, see OpenText Functional Testing for Developers tests. |
OpenText VuGen |
OpenText Virtual User Generator (VuGen) is a tool for creating testing scripts that emulate the behavior of real users on your system. For details, see, OpenText VuGen test scripts. |
Upload a script
This section describes how to upload the scripts you want to use in your performance tests from the user interface.
Tip: You can also upload VuGen, JMeter, Gatling, Kafka, and other types of test scripts from the REST API. For details, see Scripts in the REST API Guide.
To upload a script:
-
In the banner, click the module name or the arrow and select Test Management > Tests & Scripts.
-
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.
-
Click the Upload script button
, and configure the following settings.
Action
How to
Select scripts -
Click Select Scripts, and find the directory where the scripts you want to upload are stored.
-
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: ~ ` ! @ # $ % ^ & * ( ) + = < > / \ [ ] " { } : ; ' , ? |
Configure upload settings You can configure the upload settings.
-
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.
-
-
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.
-
-
(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.
-
-
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.
Create a script
This section explains how to create a script in the 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 the Web client:
-
In the banner, click the module name or the arrow and select Test Management > Tests & Scripts.
-
In the test management tree, select a destination folder for the script, or Create a test folder.
-
Click the New Script button
.
-
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: | * : ; ! % ? / \ - < > ' & =.
-
Click Create to add the new script template to the specified folder in the test management tree.
-
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.
-
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 OpenText Virtual User Generator Help Center, and Encode sensitive data in the OpenText Performance Engineering for Developers Help Center.
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:
-
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.
-
In the banner, click the module name or the arrow and select Download Applications (under More tools).
-
Select VuGen Script Converter and click Download.
-
Install the script converter and run VuGenScriptConverter.exe.
- To launch the VuGen Script Converter, run VuGen Script Converter from the Start menu of a host machine.
-
-
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.
To convert a test to a VuGen script using the script converter
-
Select the test and specify a location for saving the converted script.
-
Click Convert. The converted script is saved in ZIP format.
-
(For JUnit tests only) Before running the converted VuGen scripts, make sure to update the Runtime Settings > Java Environment Settings > Classpath of the Vuser group, with the JUnit path and the dependent jars. For more details on runtime settings, see Configure runtime settings.
To convert the test from a command prompt
-
Open a command prompt, and go to the VuGen Script Converter folder.
-
Type
VugenScriptConverterCmd.exe
, followed by the required arguments, where:-s
is the source path and file name.-o
is the output path.-silent
converts the script in silent mode (does not prompt for user input or open the folder to the created script).Example:
VugenScriptConverterCmd.exe -s:C:\Program Files\UnitTests\junuit.jar -o:\UnitOutputDir
-
Select the test and specify a location for saving the converted script. Click Convert. The converted script is saved in ZIP format.
-
View script details
This section describes the script details page which provides details of uploaded scripts.
To view script details:
-
In the banner, click the module name or the arrow and select Test Management > Tests & Scripts.
-
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. All scripts that contain the search string are displayed.
Filter the tree for scripts Click the Filter button
and select Script
to display scripts only, or the All button
to display all 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 OpenText 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.
-
Edit a script
This section describes how to view and edit a Vuser script directly from within the 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:
-
In the banner, click the module name or the arrow and select Test Management > Tests & Scripts.
-
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.
-
-
In the Description box, click the Edit button
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 the script details page.
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:
-
In the banner, click the module name or the arrow and select Test Management > Tests & Scripts.
-
Click a script in the test management tree. The script details page opens.
-
Select an action and click the Edit Parameters button
.
-
Select the script parameters you want to edit and modify as required.
Pane Description Parameter List pane In the Parameters List pane, you select a parameter file and parameter. The toolbar options (New/Rename/Delete Parameter File) are not supported. Parameter Management pane The management area displays a table from which you can manage the values of 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 Parameters List pane. 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.
Data Assignment pane In the Data assignment pane, you define data 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 Parameter List 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 OpenText Performance Engineering for Developers or OpenText Core Performance Engineering. It is not supported running DevWeb scripts from OpenText Enterprise Performance Engineering.
-
Allocate values for each Vuser. Directly under this option, specify the block size (number of values) to allocate to each Vuser.
-
-
See also: