Replacing literals with dataset references in the Visual Studio IDE

If you have an existing test script, you can replace literal values in the script with dataset references to add realistic data to the script. You can find and replace all literals, or selectively replace the number, string, or boolean literals with a dataset reference.

Before you begin

About this task

You can also add a literal from a script to a dataset. If you do not use an existing dataset variable, the same literal values (the values that were captured when you recorded the test script) are used each time that you run the script.

To replace a literal with a dataset reference:

Procedure

  1. Click Script > Find Literals and Replace with dataset Reference.
  2. Under Literal Type, select or clear the appropriate check boxes:
    • All -- Click to find all literals in a script.
      • Numbers -- Click to find number literals in a script. A number includes integers (a whole number, not a fractional number, that can be positive, negative, or zero)or floating numbers (positive and negative decimal numbers).
      • Strings -- Click to find string literals in a script. A string stores alphanumeric values such as name, city, or state.
      • Booleans -- Click to find boolean literals in a script. Any use of the boolean literals true or false are flagged for substitution.
    • Search up -- Click to move back up through the test script. Clear to move forward through the test script.
  3. Click Find Next to start the search.

    The name of the literal found in the test script appears under Literal.

  4. Click the dataset Variable arrow to display the dataset variables and then click the dataset variable that you want the script to reference.
  5. Optionally, type a new variable name for the dataset variable you selected.
  6. Optionally, click the Add literal to dataset check box to add the literal value to the dataset.
  7. Click Replace to replace the literal in the script with a dataset variable reference.

    The cursor automatically moves to the next literal in the test script.

    Note: If you have a literal that is a choice in a combo box in the application-under-test, when you replace the literal with a dataset reference, you get a string data type instead of an a enumerator data type in the dataset.
  8. When you find the next literal in the test script, repeat steps 4 through 6.
  9. When finished, click Close.

    HCL OneTest UI updates the dataset with any new columns and initial values that you add in this dialog box.

Results

Related Topics:

Editing datasets

Associating a dataset with a Test Script

dataset Literal Substitution Dialog Box

What to do next