Test parameters

This section describes how to work with test parameters.

Test parameters overview

You can add parameters to your tests. A test parameter is a variable that can be assigned a value outside the test from which it is defined. Using parameters can increase the flexibility of your tests by enabling you to run the same test repeatedly with different data each time.

When working with a manual test

You can add parameters to the design steps from within the test or you can add parameters by calling them from other tests. This is useful if you have common steps you often want to perform as part of other tests.

Example: You can create a template test Login_Template that logs a user in when you start the application. You need to call this test at the beginning of each test. In some cases, you want to log in as a regular user while in others, you need to log in as the project administrator.

For this purpose, you can create two parameters, <<<user name>>> and <<<password>>>, and change the values according to the type of test that is calling Login_Template. If the most common login is a regular user, you can set the default values for the parameters to a regular user name and password.

For details on calling manual tests, see Call a test.

When working with an automated test

You can define parameters for a test script from within the test or you can load parameters from a shared test resource file. For details on using test resources, see Test Resources.

Back to top

Add parameters to tests

Add parameters to a test and then select which parameters to add to a test step.

Business Process Testing/UFT One: When working with a business-process or GUI-Test test type, different options are available for working with test parameters. For details, see Work with parameters, iterations, and configurations and the UFT One help.

Prerequisite:

A manual test is defined in the test plan tree. For details, see Create tests.

To add parameters to a test:

  1. From the test plan tree, select the target test.

  2. In the Parameters tab, plan and define the test parameters to be used in the test design steps.

    1. Click New Parameter

    2. In the Test Parameter Details dialog box, provide the following information, and click OK.

      Field Description
      Parameter Name Give the parameter a unique name.
      Default Value

      The default value of the parameter.

      Click in the text box to display a toolbar for formatting and spell checking the text.

      Description

      The description of the parameter.

      Click in the text box to display a toolbar for formatting and spell checking the text.

  3. Add parameters to design steps.

    1. In the Design Steps tab of the test, select the design step to which you want to add parameters.

    2. Click Insert Parameter .

    3. In the Parameters dialog box, select the parameters you want to add to the design step, and click OK.

      • To add a new parameter to the design step, click New Parameter.

      • To filter parameters in this dialog box, click Set Filter/Sort. For details, see Filter dialog box.

      • To select multiple parameters, use the Shift or Ctrl key.

      Alternatively, to add a new or existing parameter to the design step, you can enter the parameter name in the Description or Expected field. The parameter name should follow the <<<parameter name>>> syntax. For example, <<<password>>>.

      If you apply formatting to a parameter name in a design step, you must apply the same formatting to the entire parameter name, including the <<< and >>> characters. For example, if you want to italicize the parameter <<<password>>>, you must italicize the entire string <<<password>>> and not just the word password.

      Note: If a parameter is added in a design step, the Used column of the parameters grid in the Parameters tab is checked off for the parameter.

  4. Assign actual values to parameters.

    The actual data of a parameter is the data to be used during a test run. You can use parameter default values as actual values.

    According to your testing policy, you can assign actual values at any of the following stages. At each of these stages, you can only assign values to parameters that have not already been assigned values.

    When you call a test with parameters

    If you assign actual values to parameters when you call a test, the values are automatically applied to each test instance that you create from the calling test.

    When you create a test instance If you assign actual values to parameters when you create a test instance, the values are automatically applied to each run of the test instance. You can also assign actual values to test instances in the Execution Settings view of a test instance.
    When you run a test

    If you assign actual values to parameters for a test run, the values apply to that test run only. If you do not assign actual values at this stage, the test will run with null values.

Back to top

See also: