The following are the types of parameters in LoadRunner:
- Custom
- File
- Date/Time
- Group Name
- Iteration Number
- Load Generator Name
- Random Number
- Unique Number
- User Defined Function
- Vuser ID
- XML
a. Custom:
To specify the parameter data type, you can use the Custom parameter type. This is a simple parameter type and has a single value input. The custom parameter type is specially used for the application URL, port number etc.
b. Date/Time:
This parameter type generates the value in date and time format. It can generate past, current and future date/time. You can also specify the format of the value by choosing the given date/Time format. Apart from this, you can also create a custom format and generate the value as per your need. Date/Time parameter has a variety of formats which help to generate the value in any format.
To create a custom date/time format, you can use the below tokens:
Offset: This option is used to generate past and future date/time. You could create a Date/Time parameter, choose the format that you need for the date then select ‘Offset parameter by’ and enter the day/hour/minute/seconds which you want to set as an offset.
Let’s say if you have given 30 (days) 00:00:00 (HH:MM:SS) in the offset field then LoadRunner will generate a future date value. The value will be 30 days ahead from the current date.
To generate the past date you need to checkmark the ‘Prior to current date’ option. This will give you a value for having a past date or time.
The ‘Working days only’ option provides the feature to generate a date of working days only. LoadRunner automatically adjusts the working day while generating the value.
Update value on: This setting helps to specify when the next parameter value will be chosen. It has the following options
- Each Iteration: When a new iteration starts only a new date/time value will be generated. Otherwise, the same parameter value will be continued throughout the iteration.
- Each Occurrence: When a parameter has multiple occurrences in the same iteration then this option will generate a new date/time value for each occurrence. For example, if a parameter has 3 occurrences in the same iteration then 3 new date/time values will be generated.
- Once: This option restricts Vuser to use the date/time value only one time throughout the test. ‘Once’ option is helpful when you need unique values in the test.
c. File:
This is a very common and frequently used parameter type in LoadRunner. When you replace a value with a new parameter in the script, by default LoadRunner shows File as a parameter type. Refer to the below figure (Figure 05):
File Path: The file path shows the name of the .dat file having the same name as the parameter. This file contains the test data which appear in the tabular format in the Parameter List pop-up (Figure 06). The column name in the table is also as same as the parameter name. You can add, edit or delete the parameter value directly in the table or by using the ‘Edit with Notepad…’ option. If you already have test data in text, .dat or excel file then use the ‘Import Values’ option to import the data in the script. By default, the parameter name and .dat file name are the same which can be changed as per your need.
Note: You can also browse an existing .dat file of the different scripts along with test data using the ‘Browse’ option next to ‘File path’.
Add Row: Additional Test Data (values) can be inserted using the ‘Add Row’ button. You can insert multiple rows as equal to the test data.
Add Column: If 2 parameters have one relationship then the File parameter type is very helpful. An additional column can be inserted using the ‘Add Column’ button and named the parameter that would be used in the script. Refer to the below figure, previously it had only one parameter (p_UserName) and later on, a new column was added (named p_Password). When you click the ‘Add Column’ button, a pop-up opens where you can provide the name of the new parameter/column. Insert the name of the parameter and then click ‘OK’.
Edit with Notepad: You can add test data either by clicking on cells or using the ‘Edit with Notepad’ option.
Select Column: Using this option, you instruct VuGen/LG which value needs to be picked up. Here 2 options are available.
- By Number: It specifies the column number. If you select the ‘By Number’ option and provide the value as 2 then the 2nd column test data will be selected.
- By Name: It specifies the column name. The name of columns appears in the drop-down, you can select the column that appears in the dropdown list.
File Format: In the File Format section,
- Column delimiter: It specifies the type of separation between the test data columns. You can choose Comma, Tab and Space as a column delimiter.
- First data line: It specifies the starting row number from where the data has to be read. If you provide the value as 3 then the value of the 3rd row i.e. PerfMatrix03,Pass03 will be picked up for the first iteration and continue from the 3rd row onward in the next iterations as per the ‘Select next row’ and ‘Update value on’ settings.
Select next row: This option helps to set-up the data selection method during the test. The methods are ‘Sequential’, ‘Random’, ‘Unique’ and ‘Same line as XXX.
- Sequential: It specifies the sequential (i.e. one by one) selection of the value from the given list.
- Random: This input option selects a random number from the given list.
- Unique: It helps to set-up a unique selection of the values.
- Same line as <parameter_name>: When two parameters are mapped in a table then only this option appears in the dropdown. On selecting this option, all the values in the same row are picked-up.
Update value on: This option helps to specify when the next parameter value will be chosen? The possible inputs are:
- Each Iteration: When a new iteration starts then only a new value will be selected. Else the same parameter value will be continued throughout the iteration.
- Each Occurrence: When a parameter has multiple occurrences in the same iteration then this option will pick a new value for each occurrence from the parameter list. For example, if a parameter has 3 occurrences in the same iteration then 3 new values will be selected.
- Once: This option restricts Vuser to use the available value only one time throughout the test. ‘Once’ option is helpful when you need to pass unique values in the test.
When out of values: This option specifies the action to be taken when test data is exhausted. It is available only when you have the setting like
Select next row -> Unique and Update value on -> Each Iteration
OR
Select next row -> Unique and Update value on -> Each Occurrence
If you have a setting like Select next row -> Unique and Update value on -> Once then ‘When out of values’ option will be disabled.
There are 3 actions or inputs available:
- Abort Vuser: It instructs Vuser to exit from test run when test data is fully consumed.
- Continue in a cyclic manner: It instructs Vuser to continue using the same set of test data in a repetitive manner.
- Continue with last value: It instructs Vuser to continue the test with the last value of the parameter list till the test run ends.
Allocate Vuser values in the Controller: VuGen helps to distribute block-wise parameter values. This option is available only when you have selected ‘Select next row’ and ‘Update value on’ inputs as same as shown in ‘When out of value’ option.
If you have a setting like Select next row -> Unique and Update value on -> Once then ‘When out of values’ option will be disabled.
It has two sub-options:
- Automatically allocate block size: LoadRunner allocates the block size by using its own logic.
Note: This option is disabled when you choose Select next row -> Unique and Update value on -> Each occurrence - Allocate <N> values for each Vuser: You can specify the number of parameter value allocated to each Vuser by providing block size.
Let’s take one example, if there are 18 values in the parameter list of userID and block size is 3 then userID value will be distributed among 6 Vuser like this:
d. Group Name:
A group name is specified while creating the scenario in the controller or Performance Center. That group name can also be parameterized using the parameter setting.
Select the ‘Group Name’ as a parameter type and provide the text format for the group name. You can also add custom text format using the ‘Add format->’ button. Similarly ‘Delete format<-‘ and ‘Reset formats’ buttons have their respective functions.
e. Iteration Number:
This parameter type generates the current iteration number. It is generally used when you need to develop some scripting logic using the current iteration number.
For example, out of 5 transactions in a script, the 3rd transaction should run half of the total iteration. So you can enclose the 3rd transaction within an ‘if’ condition with logic p_IterationNo%2==0.
To add this type of parameter, select the ‘Iteration Number’ as a parameter type and provide the text format for the group name. You can also add custom text format using the ‘Add format->’ button. Similarly ‘Delete format<-‘ and ‘Reset formats’ buttons have their respective tasks.
f. Load Generator Name:
The name of the load generator (the computer on which the Vuser is running). You can specify the format of the Load Generator name using the given format. ‘Add format->’, ‘Delete format<-‘ and ‘Reset formats’ have their respective tasks as suggested by their name.
g. Random Number:
This parameter type generates a random number within the specified range. ‘Min’ shows the smallest number of the range and ‘Max’ represents the largest number of the given limit. You can specify the format of the random number like other parameter types by using ‘Number format’ option. ‘Update value on’ option has the same function as explained above.
Look at the below example, the provided inputs will generate a 3 digit random number in the range of 51 to 250.
h. Table:
‘Table’ parameter type has almost similar features as ‘File’ parameter type. The only difference is the ‘File’ type uses one cell value for each parameter occurrence whereas the ‘Table’ type uses several rows and columns as parameter values, just like an array of values. Using the table type, you can fill in an entire table with a single command.
Refer to the ‘File’ parameter type to get full information on input options on the ‘File’ parameter.
i. Unique Number:
‘Unique Number’ parameter generates a number in the given range and pass in the script. Specify the start number, block size per Vuser (the number of unique numbers to set aside for each Vuser) and number format to generate the required unique numbers. For example, if you specify a start value as 1 and a block size of 100 then 1 to 100 numbers will be assigned to the first Vuser, 101 to 200 numbers will be assigned to the second Vuser and so on. During the test, the unique number will be generated for a particular Vuser from the allocated number range only.
Update value on:
This setting helps to specify when the next parameter value will be chosen. The possible inputs are:
- Each Iteration: When a new iteration starts then only a new value will be selected. Else the same parameter value will be continued throughout the iteration.
- Each Occurrence: When a parameter has multiple occurrences in the same iteration then this option will pick a new unique value for each occurrence from the parameter list. For example, if a parameter has 3 occurrences in the same iteration then 3 new unique values will be selected.
- Once: This option restricts Vuser to use the available value only one time throughout the test. ‘Once’ option is helpful when you need to pass unique values in the test.
When out of values: This option specifies the action to be taken when test data is exhausted. The possible values are:
- Abort Vuser: It instructs the Vuser to exit from the test run when unique values are fully consumed.
- Continue in a cyclic manner: It instructs Vuser to continue using the same set of values in a repetitive manner.
- Continue with last value: It instructs the Vuser to continue the test with the last value of the parameter list till the test run ends.
j. User-Defined Function:
You can create User-defined functions in LR. But when using User-defined functions to substitute parameter values, you would have to create an external .dll library for the same.
k. Vuser ID:
The ID number is assigned to the Vuser by the Controller during a scenario run. When you run a script from VuGen, the Vuser ID is always -1. You can also specify the format of the Vuser ID. Use the ‘Add format->’, ‘Delete format<-‘ and ‘Reset formats’ options as per the requirement.
l. XML:
The ‘XML’ type parameter is useful for web services. You can use an XML-type parameter to replace the entire structure with a single parameter.
‘Select next value’, ‘Update value on’, ‘When out of values’ and ‘Allocate Vuser values in the Controller’ have similar functions as explained in the ‘File’ type parameter.
You may be interested: