Replacing literals with datapool references

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

About this task

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


  1. Click Script > Find Literals and Replace with Datapool Reference.
  2. Under Direction, click Forward or Backward to set the direction you want to search through a test script.
  3. Under Literal Type, set the type of literal you want to find from the following list:
    • 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.
  4. Click Find to start the search.

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

  5. Click the Datapool Variable arrow to display the datapool variables and then click the datapool variable that you want the script to reference.
  6. Optionally, type a new variable name for the datapool variable you selected.
  7. Optionally, click the Add Literal to Datapool check box to add the literal value to the datapool.
  8. Click Replace to replace the literal in the script with a datapool 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 datapool reference, you get a string data type instead of an a enumerator data type in the datapool.
  9. When you find the next literal in the test script, repeat steps 5 through 7.
  10. When finished, click Close.

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