Example: Link substitutions to references with rules


You can create data correlation rules to link substitutions to references.

If you are familiar with the application under test and know the exact location of the reference in the response data, write a Create a reference rule that uses a regular expression to locate the reference data, and then insert a Create a substitution rule as a child of the Create a reference rule.

  1. Open a data correlation rule set in the rules editor.

    A new rule set contains one empty rule pass.

  2. Create a reference rule.

  3. Right-click the Create a reference rule, and then click...

      Insert Item | Link with substitutions

  4. Right-click the Link with substitutions rule, and then click...

    To use the value of the reference extracted by the parent rule, type %refname% for the Regular expression, where refname is the name of the reference created by the parent rule.

    A Create a substitution rule is inserted as a child of the Link with substitutions rule.


Results

When you recorrelate test data with this rule set, the references and substitutions that you defined are created and linked.


Example

Assume that a response in the test data contains an ID present in URIs and in POST data throughout the test. For example, the response includes...

Assume that a URI in the test is...

...and the POST data includes...

Because you know the exact location of the ID in the response, you can write a rule that creates a reference for the ID. Specify the Reference name as ID. Then, add rules for two substitutions as children of the reference rule. Add one substitution with a URI attribute and one with a data attribute. Specify %id% in Regular expression for both substitution rules. 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:


Error 404 - Not Found

Error 404 - Not Found

The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance.