Correlation Rule automates the time-consuming, error-prone and painful task of:
- Creating variable extractions,
- And replacing dynamic values with variables in requests.
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,
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.
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.
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¶
The following procedure explains how to import Correlation Rules from a Framework:
- Click on the Frameworks button in the bottom right corner of the Correlation Rules panel,
- Select the framework to import,
- If not already there, new correlation rules are created and available in the left table.
OctoPerf SaaS currently supports these frameworks:
- DOT NET
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:
You can then go to another project of your choosing and hit paste to duplicate them:
This works the same way as the action tree copy/paste.
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:
- Insert a Regexp Post Processor or JSON Post Processor into your Virtual User,
- Configure the extractor,
- Click on the Convert to correlation rule button in the top right corner,
- The Correlation rules page opens, and the newly created rules is selected.
Make sure to check our video tutorial on how to create a correlation rule.
Update Correlation Rule¶
The following procedure explains how to edit a Correlation Rule:
- Select the rule to update,
- Set the correlation rule name on the right,
- Configure the extraction part, it is like the advanced mode of a Regexp Post Processor or JSON Post Processor,
- Configure the injection part (see below),
- Close the rules panel by clicking on the Close button positioned at the top right corner.
For each correlation rule, a table lets you configure where to inject the extracted values:
|In||Where to replace: in POST bodies, query parameters, HTTP Headers, etc|
|with name||The name of the POST Parameter, Query Parameters or Header whose value to replace (On available if the In selected is
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:
- Click on the rule to remove in the correlation rules list,
- Click on the Delete button, at the bottom of the panel.
You can use SHIFT + click or CTRL + click to select multiple variables and delete them all at once.
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.
All correlation rules are applied at once on the Virtual User. The correlation rule algorithm will work as follows:
- Search for values matching the Post Processor Extractor from each correlation rule,
- Search for these potential values in all requests,
- Extract and replace the value automatically if it is used in at least a request,
- 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.
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 re-done.