Parameterize scripts

Use parameters in your scripts to enable the use of varying values rather than constant ones.

Overview

This topic describes parameterizing scripts, data-driving tests, and managing parameters.

Parameterize your script

When you parameterize a script, you replace constant values in the script with parameters. This enables you to re-use steps and create more flexible scripts.

More importantly, it enables you to run the script multiple times, easily providing different data for each iteration. This data-driven testing lets you see how your application runs when different values are provided.

Data drive your test

When you create parameters, you can specify default values to replace them with during the run, if no other values are provided for the test run.

In Codeless Tests or MBT Tests, you can create data sets, in which you specify parameter values to use when running the test. When you run your test with a data set, the script runs iteratively, using one row of parameter values from the data set for each iteration. For details on creating data sets and using them in your test runs, see the ValueEdge Help Center.

Manage your parameters

Once a script is associated with a Codeless Test or Unit, the parameters are synchronized between the script and the test or unit. Any parameter names or default values added, modified, or removed in the Parameters tab of the test or unit are reflected in the Script parameters list, and vice versa.

If you save parameter changes in a Codeless Test or Unit while its script is open in FT Design, you see the changes in the script only if you reopen or reload the script. See also Managing changes from multiple sessions.

You can create input parameters and output parameters.

  • Use an input parameter to pass a value to a step's action or pass a string used to describe an object.

  • Use an output parameter to store the output value of a step to use later.

In FT Design, create and manage your scripts' parameters in the Script parameters pane, and use them in your script steps:

Back to top

Create script parameters

In the Script parameters pane, you can create, rename, and delete parameters. You can also define the default values to use for each input parameter. You can create parameters in advance, or while editing your script steps.

To create a parameter:

  1. In the upper right corner, click the @ icon.

    The Script parameters pane opens.

  2. Click + Create new.

    The Add New Input/Output Parameter dialog box opens

  3. Enter an unique parameter name. For input parameters, define a default value.

    • When you name a parameter, consider the following restrictions:

      • Case-sensitive

      • Must begin with a letter

      • Cannot contain spaces

      • Cannot contain the following characters: ! @ # $ % ^ & * ( ) + = [ ] \ { } | ; ' : " , . / < >

    • Only String type parameter values are supported.

To manage parameters in the Script parameters pane:

  1. To modify a parameter's name or value, select an input or output parameter and click the Edit button.

    When you change the name of a parameter, the parameter name is also changed in any steps that use this parameter.

  2. To delete an input or output parameter, select a parameter and click the Delete button.

    Before deleting a parameter, make sure it is not in use by any steps. After deleting the parameter, any steps that used it are marked as incorrect.

Back to top

Pass a value to a step

You can use an input parameter to pass a value to a step.

To pass a value to a step in the Editor:

  1. Open a codeless automation script.

  2. Select the step in which you want to use an input parameter.

  3. Hover over the value or the object name in the step until the cursor changes to a hand pointer.

    Click the value or object name to open the parameter list.

    Alternatively, you can type @ in the step line to open the list of parameters. Make sure to type the @ in a place in the step where it is relevant to insert a parameter.

  4. In the parameter list, select an existing input parameter or click + New parameter to create a new one.

    The value or object name in the step is replaced with the selected parameter.

  5. To convert back to the original constant value, hover over the parameter, click it, and turn off the Use Input Parameter option.

To pass a value to a step in the step editing pane:

  1. Open a codeless automation script.

  2. Select the step in which you want to use an input parameter.

  3. Click the icon next to the Text identification or Value input box.

    Note: Parameters are supported only for specific object classes.

  4. In the parameter list, select an existing input parameter or click + New parameter to create a new one.

    The parameter is automatically added to the Text identification or Value input box and the step.

  5. To convert back to the original constant value, click the icon again and turn off the Use input parameter option.

Back to top

Store a value in an output parameter

You can pass a constant value, the value of an input parameter, or the value of an AI object into an output parameter.

To pass... Type...
a constant value

Set "value" into @<output parameter name>

the value of an input parameter

Set @<input parameter name> into @<output parameter name>

the value of an AI object

Type one of the following syntax:

  • Set value of '<text for identification>' <control type> into @<output parameter name>

  • Set '<text for identification>' <control type> value into @<output parameter name>

When you type @ in the step line after a Set command, a parameter list opens for you to select or create an output parameter:

You can also hover over an empty line, click , and select Set output param to insert the Set "value" into @<output parameter name> syntax.

To store the step result in an output parameter:

In the step editing pane, you can save the result of a conditional step or a verification step in an output parameter. For details, see Add conditional steps and Add verification steps.

Back to top

See also: