‘Correlation’ term refers to the handling of dynamic values coming from the server. These dynamic values are the unique values which are generated by the server for security purpose like the session ID, authorization token etc. In some cases, dynamic values also refer to the web content like values in a drop-down list, calendar date, item ID, product ID, order number etc. Through correlation, you can capture these dynamic values and pass in the subsequent requests. This is the basic concept of ‘Correlation’ in LoadRunner.
Why do we need to correlate the dynamic values?
To get the answer to this question, firstly you need to understand what exactly happens at the time of script recording, script replay and after correlating the dynamic values.
Let’s see, how the client and server act when some dynamic values are exchanged between them? This is the scenario while you record a script:
When you replay the script without any changes then the script fails because of the dynamic value (sessionid) generated by the server does not match with the value return back by the client. Refer to the given Figure 02, while replaying the script, the server generated the session id as 222, but vuser script sent the recorded value i.e. 111 which was captured during recording (Figure 01). Hence the server refused to serve the request and threw an error.
Now, when you correlate the dynamic value (sessionid) and replay the script then the vuser script captures and saves the latest value generated by the server and sends back to the server in the next request. The server validates the returned value with generated value and gives the proper response. Hence the request is marked as passed at user end.
Hope you understood, why correlation is so important in VuGen scripting.
Now, the second thing that you should know is:
What are the common values which require correlation?
- Session ID
- Access Token
- Customer Name / ID
- Order Number
- Bill Number
- Number of records displayed on a page
- Current Date and Time
There could be more values which depend on the type of the application and the term used to denote them. Keep in mind your ultimate goal must be to find out all the dynamic values which cause the failure of the script and correlate them. Now, the next question arises “HOW?”
In LoadRunner, there are two methods to correlate the dynamic values which are:
- Automatic Correlation
- Manual Correlation
If we further categories automatic and manual correlation then we can see there are multiple methods to find out the dynamic values in the script. Those methods are:
1. Automatic Correlation:
- before recording (Rules)
- after recording (Record)
- after replay (Replay)
2. Manual Correlation
- Using WDiff (By comparing two scripts for identical flow)
- Using Replay Log
This is an overview of correlation topic which also covered the requirement of correlation in Performance Testing. The next posts will cover detailed information on Automatic and Manual Correlation.
You may be interested: