Skip to content

Correlation Rule

Correlation Rule automates the time-consuming, error-prone and painful task of:

  • Creating variable extractions,
  • And replacing dynamic values with variables in requests.

A Correlation Rule is composed of a Regexp Post Processor or JSON Post Processor and of Injection Rules.

It lets you apply the Post Processor Extractor globally to a Virtual User and inject the generated variables into subsequent HTTP Request actions.

The Injection Rules are used to restrain where the variables are injected :

  • In query parameters,
  • In post bodies,
  • Etc.

When applied to a VU, the Correlation Rule generates one or more Regexp/JSON Post Processor.

These rules are common to a project, and can be created for the first VU imported. Then you can save time by applying them to all other VUs imported in the same project.

Correlation Rules List

To open the correlation rules page, simply click on the Configuration > Correlation Rules button in the Virtual User page.

The left part of the page lists all the correlation rules for the current project. Rules declared in this list are common to all the VUs of a project, and you can apply them to any of its VUs. You can use the headers of this list to filter or sort it.

The right part displays the selected Correlation Rule configuration. It is only editable if a rule is selected.

Warning

Recorded Requests/Responses are mandatory to apply correlation rules. To use them you must import a fiddler of firefox HAR file.

Import a Correlation Rules Framework

Correlation Rules Framework

The following procedure explains how to import Correlation Rules from a Framework:

  1. Click on the Frameworks button in the bottom right corner of the Correlation Rules panel,
  2. Select the framework to import,
  3. If not already there, new correlation rules are created and available in the left table.

OctoPerf SaaS currently supports these frameworks:

  • DOT NET
  • JAVA
  • OAuth
  • SAML
  • Token

Copy/Paste between projects

To import or export the correlation rules you can use the copy/paste button. Hitting copy while having correlation rules selected will copy them:

Copy/Paste

You can then go to another project of your choosing and hit paste to duplicate them:

Copy/Paste

This works the same way as the action tree copy/paste.

Tip

The copy/paste works accross projects but also different workspaces.

Add Correlation Rule

The following procedure explains how to add a Correlation Rule from an existing extractor:

  1. Insert a Regexp Post Processor or JSON Post Processor into your Virtual User,
  2. Configure the extractor,
  3. Click on the Convert to correlation rule button in the top right corner,
  4. The Correlation rules page opens, and the newly created rules is selected.

Tip

Make sure to check our video tutorial on how to create a correlation rule.

Update Correlation Rule

Update Correlation Rule

The following procedure explains how to edit a Correlation Rule:

  1. Select the rule to update,
  2. Set the correlation rule name on the right,
  3. Configure the extraction part, it is like the advanced mode of a Regexp Post Processor or JSON Post Processor,
  4. Configure the injection part (see below),
  5. Close the rules panel by clicking on the Close button positioned at the top right corner.

Injection Rules

Edit Injection Rule

For each correlation rule, a table lets you configure where to inject the extracted values:

Column name Description
Replace Part of value to replace only what is matched by the extraction rule or Whole value to replace the whole content
In Where to replace: in POST bodies, query parameters, HTTP Headers, etc
Encoding Whether to use the default automatic encoding, or force a particular encoding function around the replaced value. If left by default we will try to determine the best encoding but some HAR files might have been decoded when recording (Fiddler does that for URL encoding) leading to inconsistencies.
with name The name of the POST Parameter, Query Parameters or Header whose value to replace (On available if the In selected is POST parameter values, query parameter values or header values)

To remove an Injection Rule click on the delete button at the right of the table.

To add an Injection Rule click on the plus button at the bottom of the table.

Remove Correlation Rule

The following procedure explains how to remove a Correlation Rule:

  1. Click on the rule to remove in the correlation rules list,
  2. Click on the Delete button, at the bottom of the panel.

Info

You can use SHIFT + click or CTRL + click to select multiple variables and delete them all at once.

Warning

If a rule is deleted, it will not be available anymore for any VU of the current project. It does not affect already variabilized Virtual Users.

Apply Correlation Rules

To apply Correlation Rules to the current VU, simply click on the Apply All button:

apply-menu

In case you want to apply the rules to another script, make sure to select it in the list. By default it's the one you were editing last.

Warning

The modifications made to the VU cannot be reversed. So either apply them to a copy of your VU or try them on a fresh import that can be easily re-imported.

Then wait until the rules are successfully applied:

Apply Correlation Rule

All correlation rules are applied at once on the Virtual User. The correlation rule algorithm will work as follows:

  1. Search for values matching the Post Processor Extractor from each correlation rule,
  2. Search for these potential values in all requests,
  3. Extract and replace the value automatically if it is used in at least a request,
  4. Create or re-use extractor depending if value changes or not later in the VU.

For this reason, if some rules have already been applied they will not apply a second time. Similarly if you've already replaced a value with a parameter, the corrrelation rule will not find it and will not be able to apply.

Warning

If the correlation rules take too long, the process may be killed after a timeout. In which case they may not all have time to apply. It is recommended to try to apply them in smaller groups when this happens. Typically by copy pasting some rules away in another project.