Parameterization provides the ability to use different values in scripts and thus helps create data driven test scenarios. Parameterization also reduces the size of scripts. I recently attempted to search for articles and couldn’t find a consolidated list of the main loadrunner parameters and their usage.So decided to compile a list and write this article.
This article will outline:
- The important types of loadrunner parameters.
- How and when to use them while scripting
The Loadrunner parameter types that I will describe are –
- Random Number
- Iteration Number
- Unique Number
- Loadgenerator Name
- Vuser ID
- User-Definited parameter
These are the most widely used parameter types in the performance testing domain. Vusers take value from the data file and table. When a file type or table type parameter is used, a .dat file is created. By default all the data files are named as <ParameterName>.dat and are stored in the script’s directory. When VuGen opens the data file, it displays the first 100 rows. To view all of the data, click ‘Edit with Notepad’ and view the data in ‘parameter properties’.
File & Data type parameters are usually used –
- One file can contain values for many parameters. Every column holds the data for one parameter. Column breaks are maintained using delimiters like ‘comma’, etc
- When data in an external file and in tabular format is available. (eg. data obtained by running an SQL query)
Note – In ‘text editor’, columns are separated by using ‘delimiters’. New rows are added as new table line.
XML Parameter Types are used for multiple valued data contained in an XML structure. It replaces a complex structure in which an array can be made a part of another array. The complex structure as required in a web-service call can be replaced with a single XML parameter.
Eg., An XML parameter by the name Contact can replace a name, email id, mobile number, and address.
XML parametrization helps to have cleaner input of the data, and enables efficient parametrization of Vuser scripts. XML parameters are widely used with Web Service scripts and with SOA services.
Random Number replaces the parameter with a random number. While creating random type parameter, minimum and maximum values of the range (the range, out of which the random number is planned to be selected) is required to be set.
A Random type parameter can be used –
- To sample a system’s behaviour within a possible range of values. Eg. To randomly view the details of 50 incidents being created in the system, one can specify the range for 50 serial incident ids (eg., Min – 40001, Max – 40050) and emulate the situation. Randomly incident details will be viewed by Vusers.
- Percentage distribution of tasks’ execution by Vusers. Random number can be set to have a range of 100 ProExtender. Using if loop one can achieve appropriate percentage distribution of different tasks.
Iteration number parameter type replaces the parameter name with Vuser’s current iteration number.
An iteration type parameter can be used –
- To print the Vuser’s iteration number in external file as sometimes required while debugging scripts for data-issues.
- To allocate a unique data input per Vuser.
Unique number parameter replaces the parameter with a unique value. This value is taken from the range set by entering the start value and the size of the range.
Unique number type of parameter is used –
- To enter a unique value in the data field while script execution. (eg. Setting a unique username for a SignUp transaction of a website)
- To check system’s behavior for all possible values of the parameter.
Eg., Executing a query for all employees, whose ID numbers range from 100 through 199, create 100 Vusers and set the start number to 100 and block size to 100.
A LoadGenerator is the machine on which Vusers perform the steps as in the scripts. During test execution, Load Generator Name type parameter replaces the parameter with the name of the Vuser script’s load generator.
A LoadGenerator type of parameter is used –
- While debugging scripts, to understand if failures exist only at a particular loadgenerator.
- To segregate results and logs between different loadgenerators.
Date/Time parameter type
A Date/time parameter replaces the parameter with a date and/or time. One can specify one’s own format of date/time representation.
Date/time parameter type is used in –
- Business scenarios in which vuser wants to get specific details for specific duration of time. In the form data, the ‘from’ field-type will have value of last month’s date-time and the ‘to’ field will have date/time of current date-time.
- Scenarios in which vuser has to enter a date-time value.
- Scenarios in which vusers have to enter a unique string value for a field.
Vuser Id parameter type
a Vuser ID replaces the parameter with the ID number assigned to the Vuser by the Controller during a scenario run. When you run a script from VuGen, the Vuser ID is always 1.
Vuser id parameter type is used –
- To print the vuser id in an external file for script-debugging purpose.
- To segregate transaction volume based on Vuser ids.
A User defined parameter type is a user-defined function in which call to the function is made and the value returned by the function replaces the parameter name.
This type of parameter is used in following cases –
- Random function can be called to capture one out of the many co-related values stored in an array (created by web_reg_save_param).
- To obtain a value in a specific format that is not supported by other parameter types.
That concludes my brief overview of the main Loadrunner parameter types, let me know if there are others I have forgotten