Assigning test variable values from a dataset by using the Assign step

You can assign values from a dataset to test variables by using the Assign step. This supports dynamic data substitution during test execution, allowing subsequent steps to use unique and data-driven values.

Before you begin

You must have completed the following tasks:
  • Ensured that you are assigned a Team Space Owner, Project Owner, or Member with a Tester role to create or edit a test resource.
  • Read and understood the information in Edit branch overview and Create or select an Edit branch.
  • Ensured that your project contains a Web UI test or suite.
  • Ensured that the required variables have been created and are included in your Web UI test or suite.
  • Ensured that your project contains a dataset.

About this task

You can create datasets in Test Hub and assign their values to variables in a test. This process helps you to run data-driven tests consistently with parameters and reduces the need to repeat steps. Dataset values are mapped to variables in a test, to perform flexible data-driven testing across multiple scenarios.

Procedure

  1. Click the Edit button displayed on the Test Editor page.

    The Edit button appears only when no active edit branch is selected.

    Alternatively, right-click the test in the test navigator panel and select Edit.

    The Edit branch dialog is displayed.

    If the Edit branch dialog is not displayed, then go to step 3.

  2. Select an existing branch or create a new branch.
  3. Drag the Assign statement from the Catalog > General pane and drop it under a test step as required.
    The Assign step is inserted.
    Note:

    You can also use the Assign step within a while or do-while step, so that the Assign step retrieves the values from a dataset to process each row of the dataset iteratively and assign the retrieved values to the test variables.

  4. Click the Assign step.

    The step details pane opens with the Details tab which was the default selection.

  5. Select an existing dataset in the Dataset field.
  6. Click Add to add a variable and assign the value from dataset.
  7. Select an existing variable from the Select a variable to assign drop down.
    Note:
    You can also select Add new variable from the list to create a new variable and assign the value from the dataset.
    The variable is displayed in the Variables section.
  8. Click the drop-down icon in the variable.
    The variables in the test and column names in the selected datasets are listed.
  9. Select the column in the dataset from which you want to assign the values during test run.
  10. Click Close icon to close the run details pane.
  11. Click the Save icon to save the modifications.

Results

You have assigned the dataset to test variables in a test by using the Assign step.

What to do next

You can run the test in Test Editor and view the Functional Report to verify the test steps with the variable assignment. See Running a Web UI test.