Share this page

# Use parameters in scripts

You can replace some of the recorded values in your TruClient 2.0 - Web script with parameters, so that a variety of values are used for the argument during replay.

In this topic:

## About parameters

You use parameters to make your scripts more realistic. Instead of passing the same value each time to a step argument or Evaluate JavaScript step, you create a list of values to pass. Different values are then taken from the list when the script is run in a load test. This is known as parameterizing the script.

Only some step arguments can be parameterized. For example, a boolean true/false argument cannot be replaced by parameters.

The parameter name 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. You manage parameters and set parameter values using the VuGen interface. For details, see Parameterize scripts.

Parameters can also be used in property values of descriptors. For details, see Descriptors for scripts.

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 VTS parameterization.

Back to top

## Convert an argument value to a parameter

You can convert the value in an argument from a literal (plain text or JavaScript code) to a parameter. You can use an existing parameter file, or create a new one.

To convert an argument value from a literal to a parameter:

1. Open the Step editor for the step.

2. Select the relevant field in the step Arguments area.

3. Highlight either the entire argument value or part of the argument value.

4. Right-click and select Create new parameter from selection or Replace selection with parameter.

5. 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 for the argument value is Plain text, the entire value (regardless of whether you select the entire value, or part of it) is replaced with the name of the parameter you selected or created. The value type becomes Parameter automatically.

   - If the type for 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 script in the Development window before you can see the new parameter in VuGen.

Back to top

## Use a parameter as an argument value

In the Step editor, for some arguments, you can select a parameter to use as an argument value.

To use a parameter as an argument value:

1. Select a field in the step Arguments area.

2. Click the argument type arrow, and select the Parameter name option .

   The field value is cleared.

3. Enter the name of the parameter to use.

   When running the script, the parameter’s value is evaluated as defined in the step argument.

Back to top

## Apply 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 step in your script, to update the parameter value. For details, see TruClient 2.0 - Web functions.

Back to top

See also:

- VTS parameterization
- Steps box

https://admhelp.microfocus.com VuGen,Professional Performance Engineering,Performance Engineering for Developers 8942
Tips to improve your search results... OpenText™ Virtual User Generator Help Center OpenText™ VuGen Help 26.1 All View Local Help Center View Online Help Center Version: