Selecting a reference in a response

When a response contains multiple matches for the regular expression that defines a reference, you can select which match is used subsequently as the data source. You can specify a particular occurrence, or you can specify a random occurrence.

About this task

An application under test might return responses that contain multiple matches for a regular expression that defines a reference. For example, a response might contain multiple links to rows of data, where each row represents a different user. You can control which occurrence of the regular expression is used as the data source in subsequent data correlation.

If you edit the Regular Expression that is associated with a reference, and then click Verify or OK, and the new regular expression still connects to the highlighted string in the preview window, then the Specific occurrence number is updated automatically, overwriting any changes.

Procedure

  1. In the Test Navigator, browse to the test, and double-click it. The test opens.
  2. Locate the response that contains the reference that you want to specify.
  3. In the Content field under Test Element Details, right-click the reference, and then select Properties.
  4. Optional: To edit the regular expression that is used to locate the reference, click the Toggle regular expression assistant push button on the Properties window. The regular expression assistant displays the response content that is matched by the regular expression and the groups that are captured by the regular expression.
  5. On the Properties page for the reference, select which Occurrence to use as the data source. By default, the first occurrence of a match for the Regular Expression is used as the data source.
    • To specify a particular occurrence, select Specific occurrence number, and then type the number of the match. For example, type 4 to specify the fourth match of the regular expression in the response.
    • To specify a random occurrence, select Random occurrence.
    • To specify the last occurrence, select Last occurrence.
  6. Click OK.
    The occurrence that you specified is used as the data source for data correlation when you run the test.