Correlation in Load Runner

What is Correlation?

Correlation is a mechanism of handling the dynamic values passed from the server to the script. Correlation is important aspect which will let the script run end to end without any error.

Why we should handle the correlation in the script?

Lets take a example of session id generation.

Recording :

  • While Recording an application, the vugen will sends a request to the application server to start a new session.
  • Server receives the request from the Vugen and assign a new session ID ABCDF.
  • Vugen will stores the session id ABCDF in the script.
  • Start the session with ID ABCDF and send a request to a application server to allow the Vugen to record the flow.
  • Therefore Application server recognizes the ID ABCDF and allows the Vugen to record the script.

Reply :

  • While Replaying the record script, the Vugen script will sends a request to the server to start a new session.
  • Application server will receives the request, and start the new session ID XYZ.
  • But while recording the Vugen would have stored the session id as ABCDF and now the server is expecting the new session if XYZ.
  • Therefore the application server will reject the request to reply script with the old session.

Solution :

  • Capture the session id into a variable which is generated from the application server at the initialization of the application.
  • Replace the variable(Captured value variable) in the place of old session id(ABCDF) in the script.
  • Therefore when application is started, now the new session id is captured in a variable and passed to the next request. And the application will run without any error or failure.

Different types of correlation present in loadrunner?

  • Auto Correlation.
  • Manual Correlation.

Auto Correlation :

It is the easiest way of doing the correlation in the load runner application. VUGen will require you to run a recorded script at least two times so it can internally compare the varying values in the server response. Its seems the easiest way to do it but most of the time the auto correlation will not be working. Therefore it is not recommended to use this method.

One can configure automatic correlation at the time of recording using the below steps.

  • Create the rules in the Recording Option before recording the script . Click on Record =>Recording Options=>Rules.

Correlation Rules

  • Then make sure the scan for correlations applying is as per the below snap shot.

Correlation Configuration

Manual Correlation :

Its the most important  method used to capture the dynamic values in the loadrunner.  Its directly added the function into the script to capture the values and passed it.

Therefore below are the steps involved in capturing the dynamic values.

  • Identify the dynamic value in the script which need to handled.
  • Find the first occurrence of the dynamic value in the script.
  • Find the correct left and right of the dynamic values.
  • Add web_reg_save_param function to the script above the request where the first occurrence of the dynamic value was found.
  • Pass the correlated values in the script.

Click on web_reg_save_param to know the important parameters of the function.

Correlation Manual

Leave a Reply

Your email address will not be published. Required fields are marked *