Correlating multiple fields in a test
Some tests are structured in such a way that you must correlate data for
multiple fields.For example, assume that you plan to dataset an item that a
virtual user is buying. For the test flow to be correct, you must also dataset all occurrences
of that item in the test. You can find and correlate all instances of that item in one
procedure. Typically, you use Find More and Substitute in the
Show Dataset Candidates window to correlate data for multiple fields. See
Viewing dataset candidates when you open a test.
Alternatively, you can use the Test Search page to correlate data for
multiple fields.
Procedure
To find all instances of a field in a test and correlate some or all of the
instances with a data source, such as a dataset:
- In the Test Navigator, browse to the test, and double-click the test. The test opens.
- Locate the item or the substitution site to change or create a reference for. If the item is plain text, select the item. If the item is an existing reference, click the highlighted area.
- Right-click, and then click .
- Click OK.
- On the Test Search page, select Case sensitive to perform a case-sensitive search or Regular expression to perform a search using regular expressions. In regular expression mode, press Ctrl+spacebar key in Search for text for content assistance. Content assistance lists the regular expression patterns and the content that they match.
-
Click More Options, and then select the appropriate options:
- Restrict to elements highlighted in Test Contents
- Search only in elements that are selected in the Test Contents area.
- Highlight found elements in Test Contents
- Highlight found elements in the Test Contents area.
- Recursive
- Searches the child test elements in addition to the element. For example, if you search an HTTP page, select this option to search the requests and responses within the page.
- Match encoded and decoded values (protocol-specific)
- When selected, searches for matches of the unencoded and URL-encoded
versions of the specified text. For example, when searching in HTTP
data,
abc%123
andabc%25123
match. - Include matches with overlapping data correlation
- Include sites that are contained in, or overlap with, an existing substitution site. If you decide to substitute, the conflicting substitutions are automatically removed.
- Include matching substituters
- Click to return elements that originally matched the search string but have since been substituted. Clear to skip existing substitution sites when results are returned.
- Click Close.
- Click Search. The search results are displayed in the Search view.
- In the Search view, select the matches to substitute, and then right-click the selection.
- Optional: To select all matches, right-click the test name.
-
Click Substitute in DataSource View.
This action sends the selected matches to the Test Data Sources window.
-
In the Test Data Sources window, click the tab that corresponds to the
type of data source to use:
Option Description References The data sources that have already been created in the test and the possible matches that are available as data sources for the selected substitution site. For example, text that is found in a response and used in a subsequent request is automatically created as a reference. Clear the Matching References Only check box to see all the references that occur before the substitution site in the test. Datasets The datasets that have been added to the test. To add a new dataset, click the Add new Dataset icon (). Custom Code If you have written test execution services (TES) custom code, the custom code that is available as data sources for this substitution site. Test Variables The test variables and their types that are available as data sources for this substitution site. Built-in Datasources The dynamically calculated data sources (Current Date, Random Number, Sequential Number, and Timestamp) that are available for this substitution site. To create a new built-in data source, right-click inside the Built-in Datasources page, and select New. -
Select the data source, and click Substitute From.
The Substitute Multiple Items window is displayed, showing information about the data source and substitutions sites that you selected.
-
For each site with a selected check box, click Substitute Checked to
substitute the data source or clear the check box to skip the site.
Click Always Prompt to examine every substitution site one at a time. Click Prompt on overlapping data correlations to examine a site only if the site you are substituting into is contained in, or overlaps with, an another substitution site. If you decide to substitute, the conflicting substitutions are automatically removed.