About Data Correlation
A web application can include dynamic parameters in responses and reuse these parameters in subsequent requests. Users cannot control these parameters directly.
Usually, these parameters are in hidden fields on a web page or in a request URL.
A typical example is a session or client ID that keeps track of user sessions within the application and changes from one application session to another. Another typical example is a database record identifier that is added to a tested database and then changes during the test run:
Client ID in a server response
Client ID in a subsequent client request
Examples specific to ASP.NET applications are the dynamic ViewState and EventValidation parameters and links to the assembly resources served via the WebResource.axd and ScriptResource.axd files.
The dynamic nature of these parameters means that during the test run, the application generates and returns a parameter value that differs from the recorded value. In order for the test to pass, LoadComplete needs to capture the actual value of the dynamic parameter from a server response and insert it into subsequent requests instead of the recorded value. This is data correlation.
Support for Data Correlation in LoadComplete
LoadComplete can correlate dynamic parameter values in scenarios.
To correlate data in scenarios, it extracts values of dynamic parameters from server responses and inserts those values into subsequent requests.
The image below shows correlating parameters of a Rich Internet Application:
Step 1: Saving server response data
Step 2: Inserting the variable value
|Note:||During simulation, LoadComplete waits for the server response containing the correlation data for the period that the Request correlation timeout option sets (5 minutes, by default). If the server does not return the needed data before the period elapses, LoadComplete will report a timeout error and will not simulate the request that uses the data.|
LoadComplete can correlate dynamic parameters automatically. It can detect dynamic parameters in scenarios, extract the parameters from server responses and insert them into subsequent requests.
You command LoadComplete to find and correlate dynamic parameters in your scenario by using the Correlate Request and Response Parameters wizard.
LoadComplete shows the wizard automatically after the scenario recording is complete. You can also call the wizard any moment at design time by clicking on the Scenario editor’s toolbar:
Typically, automatic correlation rules handle dynamic parameters automatically. However, there can be situations when you have to correlate dynamic parameters in your application manually.
To learn how to configure your scenarios to extract dynamic data from responses and then insert that data into subsequent requests, see Correlating Dynamic Parameters Manually.
Modifying Correlation Data
There can be situations when you need to modify a dynamic parameter received from the server before you use it in subsequent requests. You can do it by using the Set Variable Value operation.
To learn more, see Modifying Correlation Data.
Configure LoadComplete to use real-time cookies:
In the Simulating - General dialog, enable the Use real-time cookies option.
During the test run, LoadComplete will get the actual cookies that the tested web server returns, and use them in subsequent requests.
To configure your scenarios to extract specific cookies from responses and use them in subsequent requests:
Configure LoadComplete to correlate cookies:
In the Data Correlation Options dialog, enable the Common/Cookie correlation rule or create custom cookie correlation rules.
After the scenario recording is over, command the Correlate Request and Response Parameters wizard to correlate the recorded traffic. It will create data selectors to extract data from cookies and data replacers to insert the extracted data into subsequent requests.
– or –
Create cookie selectors and cookie replacers in your scenarios manually. See Creating Custom Data Correlation Rules Manually.
(When creating the data replacer rule for a cookie, we recommend setting Cookie in the Area column rather than Header (Path) or Header (RegExp)).
For more information on handling cookies, see Managing Cookies.
Data Correlation Alternatives
You can replace the recorded values in requests with data you get from an external data source of with data LoadComplete generates. Each virtual user will send requests with individual dynamic parameters. This will make the testing more realistic.
To learn how to do this, see Parameterizing Requests.