You can create data correlation
rules to link substitutions to references.
About this task
If you are familiar with the application under test and
know the exact location of the reference in the response data, write
a Create reference rule that uses a regular expression
to locate the reference data, and then insert a Create substitution rule
as a child of the Create reference rule.
Procedure
- Open a data correlation rule set in the rules editor. A new rule set contains one empty rule pass.
- Create a Create reference rule. See Creating a reference using data correlation rules to learn more about creating a Create
reference rule.
- Right-click the Create reference rule,
and then click . See Creating a substitution with data correlation rules to learn more about creating a Create
substitution rule. A Create substitution rule
is inserted as a child of the Create reference rule.
Results
When you re-correlate test data with this rule set, the references
and substitutions that you defined are created and linked.
Example
Assume that a response in your test data contains an ID that
is present in URIs and in POST data throughout the test. For example,
the response includes
...<NeededID=ID123 docHelpName=rules>....
Assume that a URI in the test is http://host:port/RPTHelpID123/index.jsp?topic=datacorrelation.html
and the POST data includes
...nameID123=ID123....
Because you know the exact location of the ID in the response, you
can write a rule that creates a reference for the ID. Then, add two
substitution rules as children of the reference rule. Add one substitution
rule with a URI attribute and one with a data attribute. Specify
.*? in
Regular
expression for both substitution rules. Because the reference
rule locates the
ID123 value, and because the substitution
rule is a child of the reference rule, the
ID123 value
is used as input for the regular expression in the substitution rule.
Thus, the regular expression in the substitution rule becomes the
ID123 value
when the rules run. This regular expression creates substitution sites
in every location where the
ID123 value is found
in URIs and in POST data. In this example, three substitution sites
would be created: RPThelp
ID123, name
ID123,
and nameID123=
ID123.