In LoadComplete, you can define correlation rules that specify how it finds and correlates dynamic parameters in recorded traffic.
You can command LoadComplete to analyze recorded traffic and create correlation rules automatically, or you can create custom correlation rules manually. You do this in the Data Correlation Options dialog or in the Data Replacers panel of the Scenario editor. In the dialog, you can create a correlation rule anew, and in the panel, you create a rule from a parameter you correlated earlier. Let’s see how these approaches work.
In the Data Correlation Options dialog
-
Open the Data Correlation Options dialog. To do this, select Tools > Options from LoadComplete main menu and then select Recording > Data Correlation in the resulting dialog.
-
In the dialog, select a framework, for which you want to add a new rule, or create a new framework.
-
Add a new rule to the selected framework or copy an existing rule to use it as a base for a new rule.
-
In the Name text box, enter the rule name.
-
Configure the created rule to correlate the needed dynamic parameter:
1. Specify the Dynamic Parameter to Correlate
-
(Optional) Specify a search pattern for dynamic parameters.
You can create a correlation rule that can be applied to multiple dynamic parameters. To do this, in the Find parameters | Expression text box, specify a search pattern (a regular expression) that the rule will use to find dynamic parameters in recorded traffic and to extract the parameter name. Later this name can be used to find parameter values in responses and requests.
To specify a regular expression
To specify a regular expressionTo specify a regular expression
You can enter the needed regular expression manually, or you can click and specify the regular expression via the Find Parameters Data Correlation Rule wizard:
Click the image to enlarge it.
To simplify creation and editing of a regular expression, the wizard shows the content of the response whose dynamic parameter you want to correlate.
To find the needed response faster, start typing the name or part of the content of the response you want to find in the Quick Search box. The wizard will filter out the list of requests and responses according to the text you are typing.
Note: |
If you do not have a project opened, or your project does not have any scenarios recorded, the list will not be available. |
Select the needed response on the list of the project’s scenarios.
The wizard will show the content of the selected response and if the specified regular expression matches any data in it, the wizard will highlight the match. If the regular expression matches several text fragments, you can switch between them by clicking arrow buttons in the Regular expression edit box.
Note: |
We recommend that you create a regular expression that matches the needed data uniquely. To do this, you can create a regular expression that matches a larger data fragment and then use subexpressions to pinpoint the needed piece of data. |
If the regular expression uses subexpressions, the wizard will show text fragments that match each of the subexpressions.
-
In the Variable name text box, enter the name of the variable that will store the extracted data.
If the Find parameters | Expression text box specifies a regular expression, you can use subexpressions to specify the variable name, in the $number
format, where number is the subexpression position in the regular expression. For example, $1
.
2. Specify How the Rule Will Extract Data From Server Responses
To extract data from an arbitrary part of a server response body or header (regular expression)
To extract data from an arbitrary part of a server response body or header (regular expression)To extract data from an arbitrary part of a server response body or header (regular expression)
-
In the Area drop-down list, select Body (RegExp) or Header (RegExp) correspondingly.
-
In the Expression text box, specify the text to extract or the search pattern. You can use the regular expression.
To specify a part of the regular expression, you can also use subexpressions (groups) of the regular expression that the Find parameters | Expression parameter specifies, in the $number
format, where number is the subexpression position in the regular expression.
You can enter the needed regular expression manually, or you can click and specify the regular expression via the Create Selector Data Correlation Rule wizard:
Click the image to enlarge it.
To simplify creation and editing of a regular expression, the wizard shows the content of the response whose dynamic parameter you want to correlate.
To find the needed response faster, start typing the name or part of the content of the response you want to find in the Quick Search box. The wizard will filter out the list of requests and responses according to the text you are typing.
Note: |
If you do not have a project opened, or your project does not have any scenarios recorded, the list will not be available. |
Select the needed response on the list of the project’s scenarios.
The wizard will show the content of the selected response and if the specified regular expression matches any data in it, the wizard will highlight the match. If the regular expression matches several text fragments, you can switch between them by clicking arrow buttons in the Regular expression edit box.
Note: |
We recommend that you create a regular expression that matches the needed data uniquely. To do this, you can create a regular expression that matches a larger data fragment and then use subexpressions to pinpoint the needed piece of data. |
If the regular expression uses subexpressions, the wizard will show text fragments that match each of the subexpressions.
To specify a part of the regular expression, you can also use the dynamic parameter name that the Find parameters | Expression search pattern returns. In your regular expression, enter the position of the needed subexpression of the Find parameters | Expression search pattern, in the $number
format.
Note: |
If you use references to the Find parameters | Expression’s subexpressions in your regular expression, the wizard will not be able to highlight matches in the selected response. |
You can click Next and tweak the created regular expression on the next page of the wizard:
If the created regular expression includes subexpressions, you can select the subexpression you want the data correlation rule to use.
You can also select a conversion rule. The correlation rule will apply the conversion rule to value extracted from a server response.
-
The specified regular expression can match a large piece of data. If necessary, you can use subexpressions to clarify the portion of data to extract.
In the Attributes text box, specify the subexpression in the $number
format, where number is the subexpression position in the regular expression.
To extract a parameter value from a Rich Internet Application response
To extract a parameter value from a Rich Internet Application responseTo extract a parameter value from a Rich Internet Application response
-
In the Area drop-down list, select Body (Path).
-
In the Expression text box, enter the parameter name (with the path) in the RIA response. For example, Message[1]/[1]/headers/TargetUrl
.
You can omit the parameter name in the path. For example, Message[1]/[1]/headers/
. The rule will search for dependencies for all parameters of the parent parameter.
You can find the parameter path in the Path column of the Response Body panel of the recorded responses.
To extract data from a server response header parameter
To extract data from a server response header parameterTo extract data from a server response header parameter
-
In the Area drop-down list, select Header (Path).
-
In the Expression text box, enter the path to the needed parameter in the response header. For example, Response/CustomHeader/ParamName
.
You can omit the parameter name in the header path. For example, Response/CustomHeader/
. The rule will search for dependencies for all parameters of the header.
To extract a cookie that a server response sets
To extract a cookie that a server response setsTo extract a cookie that a server response sets
-
In the Area drop-down list, select Cookie.
-
In the Expression text box, enter the name of the cookie whose value the rule will extract.
If the data that the rule will extract contains URL-encoded characters or HTML entities, you can command the rule to encode the data. Select the needed encode rule from the Convert drop-down list.
3. Specify How the Rule Will Insert the Extracted Data Into Requests
To insert data into an arbitrary part of a request body or header (regular expression)
To insert data into an arbitrary part of a request body or header (regular expression)To insert data into an arbitrary part of a request body or header (regular expression)
-
In the Area column, select Body (RegExp) or Header (RegExp) correspondingly.
-
In the Expression, enter the data to replace or a search pattern. If necessary, you can use a regular expression.
You can enter the needed regular expression manually, or you can click and specify the regular expression via the Create Replacer Data Correlation Rule wizard:
Click the image to enlarge it.
To simplify creation and editing of a regular expression, the wizard shows the content of the request whose dynamic parameter you want to correlate.
To find the needed request faster, start typing the name or part of the content of the request you want to find in the Quick Search box. The wizard will filter out the list of requests and responses according to the text you are typing.
Note: |
If you do not have a project opened, or your project does not have any scenarios recorded, the list will not be available. |
Select the needed request on the list of the project’s scenarios.
The wizard will show the content of the selected request and if the specified regular expression matches any data in it, the wizard will highlight the match. If the regular expression matches several text fragments, you can switch between them by clicking arrow buttons in the Regular expression edit box.
Note: |
We recommend that you create a regular expression that matches the needed data uniquely. To do this, you can create a regular expression that matches a larger data fragment and then use subexpressions to pinpoint the needed piece of data. |
If the regular expression uses subexpressions, the wizard will show text fragments that match each of the subexpressions.
To specify a part of the regular expression, you can also use values that the Select from responses | Expression regular expression extracts. In your regular expression, enter the position of the needed subexpression of the Select from responses | Expression, in the $number
format.
You can click Next and tweak the created regular expression on the next page of the wizard:
If the created regular expression includes subexpressions, you can select the subexpression you want the data correlation rule to use.
You can also select a conversion rule. The correlation rule will apply the conversion rule to value before inserting it in a request.
-
If the specified regular expression matches a large piece of data, you can use subexpressions to clarify the portion of data to replace. In the Attributes column, enter the index of the needed subexpression in the $number
format, where number is the subexpression position in the regular expression.
To insert data into a web form or a Rich Internet Application request
To insert data into a web form or a Rich Internet Application requestTo insert data into a web form or a Rich Internet Application request
-
In the Area drop-down list, select Body (Path).
-
In the Expression text box:
For a web form, enter the name of the parameter you want to replace. You can find the name in the Request Body panel of the recorded request.
For Rich Internet Applications, enter the name (with the full path) of the parameter. For example, Message[1]/[1]/clientID
. You can find the parameter path in the Path column of the Request Body panel of the recorded request.
You can also omit the parameter name in the path. For example, Message[0]/[1]/
. The rule will search for dependencies for all parameters of the parent parameter.
To insert data into a request header
To insert data into a request headerTo insert data into a request header
-
In the Area drop-down list, select Header (Path).
-
In the Expression text box, enter the path to the request’s header parameter the rule will replace. For example, Request/Query/ReturnUrl
.
You can find the needed path in the Request Header panel.
You can also omit the parameter name in the path. For example, Request/Query/
. The rule will search for dependencies for all header parameters.
To insert a cookies into a request
To insert a cookies into a requestTo insert a cookies into a request
-
In the Area drop-down list, select Cookie.
Note: |
For setting cookie values, we recommend using Cookie in the Area column rather than Header (Path) or Header (RegExp). |
-
In the Expression text box, enter the cookie name.
-
In the Attributes column, enter the cookie’s attribute. See Cookie Replacer Attributes.
To specify the parameter to replace, you can also use subexpressions (groups) of the regular expression that the Select from responses | Expression parameter specifies, in the $number
format, where number is the subexpression position in the regular expression.
If the data that the rule will insert into requests contains URL-encoded characters or HTML entities, you can command the rule to decode the data. Select the needed rule from the Convert drop-down list.
-
Save the created rule.
In the Data Replacers panel
You can easily create a correlation rule from a data replacer you created earlier for some request. LoadComplete will use this rule later when correlating response and request data automatically.
-
Open your scenario for editing.
-
In the editor, find a request with a dynamic parameter that was correlated earlier.
-
Switch to the Data Replacers panel and check the Rule column value of the desired data replacer. It should be User.
Right-click the replacer and select Create rule from the context menu:
Click the image to enlarge it.
LoadComplete will create a new correlation rule based on the parameter settings. You can see the new rule in the Tools > Options > Recording > Data Correlation dialog, under the Converted node.
Click the image to enlarge it.
See Also
About Data Correlation
Creating Data Correlation Rules Automatically
Correlating Dynamic Parameters Manually