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.

Note: When working in TruClient in VuGen, parameters are managed in VuGen. For TruClient Standalone and TruClient Lite they are saved in the Parameters dialog box in TruClient.

Add a parameter to your script from the Parameters dialog box

Note: The Parameters dialog box is available in TruClient Standalone and TruClient Lite only. In TruClient in VuGen, you add parameters to scripts from the VuGen toolbar. For details on using parameters in VuGen, see Parameterization and Create Parameters in the VuGen Help Center.

To add a parameter to your script directly, without editing a particular step:

  1. Click the parameter icon to open the Parameter dialog box, and click Add Parameter.

    The default name of a new parameter is NewParamn.

  2. Click the edit icon by the parameter and enter a meaningful name.

Back to top

Set parameter values

To maintain the list of values for a parameter:

  1. Click the parameter icon to open the Parameter dialog box. You will see all the parameters in your script.

  2. Select a parameter to edit by clicking the parameter name in the Parameters area, and edit the parameter values as required.

  3. To add data values to the parameter, click Add Row. Click the row and enter a value.

Back to top

Use a parameter as an argument value

  1. Select a field in the step Arguments area.
  2. Click the argument type arrow, and select Parameter.

  3. Enter the name of the parameter to use.

    When running the script, TruClient evaluates the parameter’s value as defined in the step argument.

Back to top

Convert an argument to a parameter

To convert an argument or part of an argument from a literal to a parameter:

  1. Select a field in the step Arguments area.

    Click the arrow to the right of the Arguments Editor icon, and select JavaScript.

  2. Highlight either the entire string or part of the string.

  3. Right-click and select Create New parameter from Selection or Replace with a Parameter.

  4. If you select Replace with a 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.

    The parameter you selected or created is displayed in the arguments field.

    Note: When performing this in TruClient in VuGen, you must save the TruClient script in the TruClient Development window before you can see the new parameter in VuGen.

Back to top

Set how and when to change parameter values during replay

In the Policy area of the Parameter dialog box, you can set when and how the values of each parameter are applied during the test.

The Update value on controls when the parameter value is updated. Select the appropriate setting:

Setting Description
Each Iteration Sets the parameter to a different value once at the beginning of each iteration. If you have five values and you run the script for five iterations, each value will be used once.
Each Occurrence Sets the parameter to a different value each time the parameter is referenced in the script.
Once Sets the parameter to the first value and never changes the value automatically.

Tip: You can also add a TC.advanceParam(name) step in your script to update the parameter value.

The Select next row controls how to choose the next parameter value. Select the appropriate setting:

Setting Description
Sequential Use the next value in the table.
Random Randomly select the next parameter value from the table.
Unique Allocate a unique value from the parameter list to each Vuser.

Back to top

See also: