Finding and Replacing Values

For information on the steps that you need to complete before you can find and replace values in a test case, see Data-Driven Workflow.

You can use the Find/Replace Values dialog box to find and replace values in a data-driven test case with links to values in tables and columns. Values are text strings, numbers, and booleans that exist in your original test cases. One of the steps in creating a data-driven test case is to find these values and replace them with references to columns in your data source.

Silk Test Classic checks to make sure that each value you select is appropriate for replacement by the column in your test case. You can turn off this validation by clicking Edit > Data Driven > Validate Replacements while you are in a .g.t file. This means that the Find aspect of Find and Replace works as usual, but that the values that you replace are not validated. By turning off this checking, you suppress the error messages that Silk Test Classic would have otherwise displayed. Any 4Test identifier or fragment of a string is considered an invalid value for replacement unless Validate Replacements is turned off. If you are new to creating data-driven test cases, we recommend that you keep this validation turned on.

Note: You can also use the Find and Replace menu bar in the 4Test Editor to find and replace values in a data-driven test case.

When you are using Find and Replace, sometimes a method requires a data type that does not match the column that you want to replace. For example, SetText requires a string, but you may want to set a number instead, or perhaps the database does not store data in the 4Test type that you would like to use. Silk Test Classic can handle these kinds of conversions, with a few exceptions.

  1. Open the Find/Replace Values dialog box.
    • Right-click into a test case in a .t file and select Data Driven Testcase. Specify the data source, the data-driven script, and the data-driven test case. When you complete the Specify Data Driven Testcase dialog box and the data-driven script opens in the 4Test Editor, the Find/Replace Values dialog box opens automatically.
    • Highlight a value in a .g.t file and choose Edit > Data Driven > Find/Replace Values.
    • Right-click a value in a .g.t file and select Find > Replace Values.
  2. Check the Text, Number, and True/False check boxes to specify what type of values you want to find or replace. By default all check boxes are checked, indicating that Silk Test Classic will look for text (string), number, and true/false (boolean) values in the test case.
  3. Select Up or Down to define the direction in which Silk Test Classic searches in the file for the value. The default is Down.
  4. Select the name of the table that contains the values that you want to link to from the Table list.
  5. Select the name of the column that contains the values that you want to link to from the Column list.
  6. Click Find Next to start searching for the values within the test case. Silk Test Classic finds and highlights various values.
  7. Click Replace to replace the found value with a link to the values in the data source.
  8. When you have finished replacing values, click Cancel.

Check the Don't show me this again check box if you want to use the re-sizable menu bars instead of the Find/Replace Values dialog box to find and replace values. You can re-display the dialog box by clicking Edit > Data Driven > Find/Replace Values or by right-clicking into a data-driven test case and un-checking Validate Replacements.