Use parameters to vary arguments
You can use parameters to create a more realistic script. Instead of passing the same value each time to a step argument or Eval JavaScript step, you create a list of values to pass. Different values are taken from the list as the load test runs. Parameters can also be used in property values of Descriptors.
The name of a parameter points to a file containing a value on each row. The parameter definition defines when to start using a new value and in what order to use the values in the list.
Manage parameters
You manage parameters and set parameter values using the VuGen interface. For details on managing parameters in VuGen, see Parameterization.
After you record a script, you can convert existing argument values to parameters directly from the TruClient Development window. For details, see Convert an argument value to a parameter.
Alternatively, you can work with Virtual Table Server (VTS) to assign parameter values from a single set of values to multiple Vusers. For details, see Use VTS in TruClient scripts.
Use a parameter as an argument value
In the Step Editor, you can select a parameter to use as an argument value.
To use a parameter as an argument value:
- Select a field in the step Arguments area.
-
Click the argument type arrow, and select Parameter.
The value is cleared, allowing you to enter the name of the parameter to use.
-
Enter the name of the parameter to use.
When running the script, TruClient evaluates the parameter’s value as defined in the step argument.
Convert an argument value to a parameter
You can convert an argument value or part of an argument value from a literal (plain text or JavaScript code) to a parameter, either an existing parameter or a new parameter created on the spot.
To convert an argument value or part of an argument value from a literal to a parameter:
-
Select a field in the step Arguments area.
- Highlight either the entire argument value or part of the argument value.
-
Right-click and select Create New Parameter From Selection or Replace Selection With Parameter.
-
If you select Replace Selection With Parameter, a list is displayed. Select the parameter from the list.
If you select Create New Parameter From Selection, enter the name of the new parameter, and click OK.
If the type of the argument value is Plain text, the entire value (regardless of whether you select the entire or part of the value) is replaced with the name of the parameter you selected or created, and the value type becomes Parameter automatically.
If the type of the argument value is JavaScript code, only the selected value is replaced with TC.getParam (“ParameterName”), and the value type remains JavaScript code.
Note: You must save the TruClient script in the TruClient Development window before you can see the new parameter in VuGen.
-
Set how and when to change parameter values during replay
You use the VuGen interface to set when and how the values of each parameter are applied during the test. Alternatively, you can add a TC.advanceParam(name) step in your script to update the parameter value.
See also: