Creating a substitution with data correlation rules

You can create a data correlation rule that creates a substitution from a regular expression that is applied to test data.

Procedure

  1. Open a data correlation rule set in the rules editor. A new rule set contains one empty rule pass.
  2. Click Insert, and then select Create substitution. An empty Create substitution rule is inserted in the rule pass.
  3. Under Details, supply information for all fields that are marked with asterisks and shaded in red. For Attribute, click the down arrow to select the attribute for which to create a substitution. Use the push buttons at the top of the window to select a protocol, and then select an attribute. To create a substitution in the data field of an HTTP request, click the down arrow, and then select HTTP > Data.
  4. In Regular expression, type a regular expression to use to locate the substitution. If only a part of the regular expression is required for a substitution, enclose that part in parentheses.
    1. Open the test, and locate the response where you want to create the substitution.
    2. Copy the text from the response to the clipboard.
    3. In the rules editor, click the Toggle regular expression assistant push button to open the regular expression assistant.
    4. Paste the text from the clipboard to the Test regular expression page of the regular expression assistant window. If the Test regular expression page is empty, the contents of the clipboard is automatically pasted in.
    5. Click the Captured group tab in the regular expression assistant. The overall group is displayed, and the captured groups are displayed. If no groups are displayed, edit the regular expression accordingly.
  5. In Base name, type a base name for the substitution.
  6. Optional: If the regular expression matches multiple groups, in Value group type or select the index of the value group to use to create the substitution.
  7. Under Remove overlap, select true to create a substitution even if the new substitution overlaps with other substitutions. The other substitutions are removed. Select false to prevent a substitution from being created if the new substitution would overlap with another substitution.
  8. Under Reference search, select First to link the substitution to the first reference in the test. Select Closest to link the substitution to the closest reference in the test.
  9. Under Encoded, select true to encode the specified attribute before searching for a matching reference. Select false to search for a matching reference without encoding the attribute. The type of encoding depends on the selected protocol and attribute. For example, HTTP data can be URL-encoded.
  10. In Log level, select the level of error data to be written to the error log. Logging lets you see which rules worked and which did not. When you are debugging data correlation rules, use the Action and Detail log levels. Typically, use the None or Summary log levels to reduce memory and disk-space consumption.
    Option Description
    None Nothing is logged.
    Summary One message is logged for the rule, no matter how many times the rule is applied.
    Action A message is logged every time the rule is applied.
    Detail A detailed message is logged every time the rule is applied.
  11. In Label, type a label for the rule. If you do not type a label name, the rule is given a default name. The default name is the base name with the regular expression appended.
  12. In Description, describe the rule. Descriptions can be useful if you share rule set files with other testers.

Feedback