Using Correlation in LoadRunner scripts - visual tutorial

Using Correlation in LoadRunner scripts - visual tutorial

Today, I will explain - what is LoadRunner correlation and how to perform it.
In my humble opinion, correlation is the key concept of LoadRunner. So, strong understanding of correlation is mandatory requirement for any test engineer, if he plans to be LoadRunner professional or even guru :)

Example from a real practice:

I recorded LoadRunner script for a web server, which contained two special fields - timestamp and checksum:

    "Name=TIMESTAMP", "Value=1192177661211", ENDITEM,
    "Name=CHECKSUM", "Value=715E19300D670ED77773BBF066DAAAE2866484B8", ENDITEM,
    // others parameters ...

Every time a client web browser connects to web server, server gets current time stamp, calculates checksum and sends them to client. These two fields are used to identify a current session. In other words, the pair of timestamp+checksum is analog of session ID.

The scheme of this interaction is the following:

Where is the problem? Let's replay the recorded LR script.

The problem occurs when I try to execute my recorded script.
Web server checks its current time with a time stamp, sent by client. If client's data is out-of-date or incorrect, then server returns an error:

The parameter "CHECKSUM" is not found or has invalid value.

There is the scheme for this interaction:

Client cannot re-use old (i.e. hard-coded) values for times tamp and checksum. It must request new data.
So, instead of hard-coded values, LR script should process dynamic data, returned from server. This can be done using a correlation:

The definition of correlation is:
Correlation is the capturing of dynamic values passed from the server to the client.

Correlation can be done with 2 ways:
  1. Automatically
  2. Manually
I will describe auto-correlation in the future posts. For now, I can say that this is not ideal solution. Sometimes, it does not work, or works incorrectly.

Manual correlation is a choice of real LoadRunner engineer. It's a kind of "must have" knowledge!
Well, let's start investigating a manual correlation.

The algorithm of manual correlation is the following:
  1. Find a dynamic value to capture.
  2. Find server's response, containing the dynamic value.
  3. Capture the dynamic value.
    Special parameter will be used instead of dynamic value.
  4. Replace every occurrence of dynamic value in script with the parameter.
  5. Check changes.
Now, I will describe each step in details:
  1. Find a dynamic value to capture
    I recommend to record and save two equal VuGen scripts. After that, open menu item "Tools / Compare with Scripts..." and you can compare both recorded scripts in WDiff:
    The differences are highlighted by yellow. This highlighting means that lines (parameters values) change from run to run. So, most probably, these values should be correlated.

    Tips: Sometimes, comparing of two scripts cannot detect dynamic values. Imagine, that you recorded this script:
        "Name=SessionID", "Value=A38E9002A41", ENDITEM,
        "Name=CurrentMonthID", "Value=4", ENDITEM,
    It's obvious, that SessionID should be correlated. What about CurrentMonthID parameter? Second recorded script can contain "Value=4" too. And it's possible, that your script will work correctly during the April (4th month is April), and will not work from 1st May! So, be careful, my dear reader :)

    Look through the source code of recorded script. Timestamp, CheckSum, SessionID, and different IDs - all of they are potential candidates to be correlated.

    Tips: Check Replay (Execution) log carefully. Errors can be there. The widespread reason of script's errors is an absence of correlations.

    Tips: Execute your script with enabled run-time viewer (menu "Tools / General Options.. / Display"). Any shown errors ("Page not found", "Session timeout", etc) indicate about potential correlations.

  2. Find server's response, containing the dynamic value
    Before script executing, please enable extended logging from "Vuser / Run-Time Settings...":
    Then execute script.
    Open Replay (Execution) log and find server's response, which contains dynamic values of TIMESTAMP and CHECKSUM:
    Great! Now we know, where server sends both dynamic values.
    And we found the step, that returns these values. This is 13th line - Action.c (13). Double click the line, containing timstamp's and checksum's values, 13th line of script will be opened:
    web_submit_data("generateChecksum.jsp",     "Action=http://eprumossd0010:8400/RMS/jsp/generateChecksum.jsp",
    This means that server's response for generateChecksum.jsp page contains dynamic values which should be correlated.

  3. Capture the dynamic value
    I will show two ways how to capture a dynamic value:
    • Automatic capturing from Tree-view
    • Manual from Script-view
    These ways are similar enough. Also, they use the same function - web_reg_save_param.

    I start from:
    • Automatic capturing from Tree-view.
      Open Tree view (menu "View / Tree view"):
      • click "View recording snapshot only" btn (2);
      • select generateChecksum.jsp page from tree view (3);
      • select "Body" to view body of server's response (4).

      As result, you will see recorded values of CHECKSUM and TIMESTAMP (5).

      Now, select value of first dynamic value (checksum), right-click, and select "Create parameter":
      After that you will see the message box:
      You can create parameter for dynamic value.
      If you want to replace all occurrences of dynamic value ("715E19...") in script, press "Yes" btn.
      To not replace all occurrences, press "No" btn.

      Tips: I recommend to not replace all occurrences of dynamic value. It can lead to incorrect results. It's more preferable to replace occurrences one by one with "Search and Replace" dlg.

      OK, I click "No" btn.

      Return to Script-view ("View / Script View") and see changes. There are new lines, inserted before generateChecksum.jsp page:

      // [WCSPARAM WCSParam_Text1 40 715E19300D670ED77773BBF066DAAAE2866484B8] Parameter {WCSParam_Text1} created by Correlation Studio

      web_reg_save_param function finds and saves a text string from the next server's response. In other words, it captures a dynamic value.

      In this example, web_reg_save_param function will save the captured value into WCSParam_Text1 parameter. The function finds the left boundary (window.parent.setChecksum(") and after that it finds the right boundary ("). The string, found between left and right boundaries, will be saved to WCSParam_Text1 parameter.
      Ord attribute indicates the ordinal position of captured value. In the example (Ord=1), we capture the value between first left boundary and left one.
      Easy to guess, that "Search=Body" means search in a body of server's response.
      I recommend to study Help on web_reg_save_param function. It's very interesting :)

      Note: the capturing of TIMESTAMP parameter is similar. It generates the following code:

      // [WCSPARAM WCSParam_Text2 13 1192177661211] Parameter {WCSParam_Text2} created by Correlation Studio
          "LB=, ",

    • Manual capturing from Script-view.
      Actually, this method consists in a manual writing of web_reg_save_param function. It requires strong knowledge on this function and its parameters. There are many attributes of web_reg_save_param function, and I do not want to duplicate HP's Help :)

      Tips: I recommend to rename default parameter (WCSParam_Text1, 2, 3, etc) to something sensible. For example, in my example - I would prefer prmCheckSum and prmTimeStamp to WCSParam_Text1 and WCSParam_Text2.

  4. Replace every occurrence of dynamic value in script with the parameter
    This is not difficult step.
    Open "Search and Replace" dlg ("Edit / Replace..."). And replace one-by-one hard-coded values with a parameter.

    Why it is important?
    Imagine, that you have the following code:

        "Name=OrderNumber", "Value=125", ENDITEM,
        "Name=UserID", "Value=125",

    If you create parameter for UserID, and perform replacing of all occurrences of its value ("125"), then it will produce the code:

        "Name=OrderNumber", "Value={WCSParam_Text1}", ENDITEM,
        "Name=UserID", "Value={WCSParam_Text1}",

    It may be wrong! OrderNumber can be static value and be equal to 125, while UserID may change.

    Now, I assume that you replace all needed occurrences of hard-coded values. We have to perform last step:

  5. Check changes
    After above manipulations, our script will look like:

        "Name=TIMESTAMP", "Value={WCSParam_Text2}", ENDITEM,
        "Name=CHECKSUM", "Value={WCSParam_Text1}", ENDITEM,
        // others parameters ...

    The statement "{WCSParam_Text1}" means "get value of WCSParam_Text1 parameter".
    So, current algorithm is:
    • when server returns different values of CheckSum and TimeStamp
    • then web_submit_data captures and places them into WCSParam_Text1 and WCSParam_Text2 parameters
    • after that we use {WCSParam_Text1} and {WCSParam_Text2} get current values of parameters and use them in scripts

    Let's run our modified script and see results of capturing from server's response:
    These are values, which are sent to a server by a client:

    You can see that dynamic values are saved to parameters and their values are substituted instead of parameters in scripts. Great! We have just correlated our script and it is working now!

    Tips: To get/debug a captured value of parameter, use the following statements:
    lr_output_message("Value of WCSParam_Text1: %s", lr_eval_string("{WCSParam_Text1}"));
    lr_output_message("Value of WCSParam_Text2: %s", lr_eval_string("{WCSParam_Text2}"));

    Execute script again, he result is:

I hope, I provided simple and understandable explanation of LoadRunner correlation.
Please, share your comments and thoughts, dear readers.

Do you have ideas for further topics - welcome :)

Dmitry Motevich,
QA / Automated testing specialist

Related articles:


Anshoo said...

Thank you.

This really clarified various doubts I had with correlation. Even though auto-correlation in LR 8.1 is over-simplified, learning manual correlation definitely helps!


Anshoo Arora

Dmitry Motevich said...

Anshoo, I'm glad, that this article helped to you :)
Feel fee to ask me, if you have some doubts with automated testing

Anonymous said...

Hi Dmitry,

Good explanation. It helped me with my questions about correlation. Thank you!

Anonymous said...

Can you please explain the difference between correlation and parameterization in LoadRunner?

Dmitry Motevich said...

2 Anonymous: OK, I will create such article, describing differences between correlation and parameterization in LoadRunner.

Keep a tab on this blog :)

Anonymous said...

Thanks very much for such a good example.I have bben looking for months for an example that explains the co-relation concept.
Iam still not very clear on how to determine weather every application that we record using loadrunner is candidate or not for cco-relation??
Warm Regards,

Dmitry Motevich said...

2 Anonymous:
I explained it in the article - re-record your script twice and compare.

If these scripts are different, then is it very probably that you have correlate them.

If these scripts are the same, then you have high confedence, that you don't need correlate them.

Anonymous said...

Hello Dmitry,

I am working with Web Services and trying to understand how to perform parameterization of the dynamic values in the xml string. There are few dynamic values passed to the web service in the input argument, wich is an xml string type. Could you please explain how to do it?


Dmitry Motevich said...

2Anonymous (signed as Gennadiy):
I plan to write new articles, explaining correlation in details. And I will describe correlating of Web Services scripts. Plan to publish it by the end of November.

Mick in California said...

Dimitry, some very good information on your blog, I will certainly come back. Can you add information on your Memory leak posting? Why the two graphs trending up are an indication to a memory leak?

Anonymous said...

could you please explain the concept of correlation with respect to flight reservation (sample application) in load runner

vignesh said...


could you tell me if i can capture a value from a request headers


i want to capture B14B296A96C18D31725F0F8BF from the above URL

this is what i have in the replay log.
Action.c(51): t=51925ms: 2375-byte request headers for "" (RelFrameId=1)

any help would be appreciated

hirok said...

hi dmitry,
your explanation regarding correlation is very helpful specially taking the architecture into has really helped clearing up my doubts to quite a few extent.great work..can you also put up some info regarding the usage of functions and their types in loadrunner.

Naveen Sharma said...

This really clarified various doubts I had with correlation. Even though auto-correlation in LR 8.1 is over-simplified, learning manual correlation definitely helps!

Can any body tell me how to pass value to such parameter mentioned below:


actully there is no ITEMDATA a large string in body.

Thanks in advance,

SP said...

Great. I was surprised to see this blog because couldnt find one when i was searching for an explanation on Correlation, last year.

Aha, it's written on 13/10/2007. So pretty new. Believe me this is going to be a pretty busy site for performance Engineers.

Thanks and if time permits please write about Web Services as well.

vivek said...

Hi Dmitry,thanks for such a nice artile on correlation.I was having lots of confusion for same but now I will try to correlate my script based on your article and I hope it will work.Can you provide me your email id so that I can be in constant touch with you for sharing my problems in LR.I am a new user of this tool and still learning.Drop me mail at

Anonymous said...

thx for nice explanation, it solved all of my doubts...

Thanks & Regards,
Mallesh Tammali...

Dmitry Motevich said...

I'm glad to now, that my article was helpful! :)
Thank you for visiting and reading

Rajasekhar said...

What suggestions you are given to your client based on your performance testing using load runner in your current project.

PravinF said...

I create script for login page; I pass only 1 user name & password while creating script.
In our application at a time more than 1user can login but different name & password required.
For above script I perform load testing for 5 simultaneous user login to our application (Using Rendezvous points) & it pass successfully. My question is how it pass because our application accepts 1 username & password for 1 user, for multiple users multiple user name & password required.

Dmitry Motevich said...

The problem maybe in your LoadRunner scripts (correlations, page verifications) or security problem with your application.

I cannot answer exactly, because you didn't provide additional info about your LoadRunner scripts and application

Jagadhesh said...

Thanks for ur information. Can u explain the how to execute the script without recording in parameterization and Checkpoints?
it can helpful for me.



Anonymous said...

Hi, this article is well-explained one. Thank you.

Anonymous said...


this helped me a lot understanding correlation.

Great example.

Anonymous said...


I have started using loadrunner8.0 recently. And I am facing a problem in correlation.

Server is sending xml data back to the client and each time this data is different. After selecting a dynamic value from this xml data, I right clicked, but i am not getting "Create Parameter" option.

How can i apply correlation on these dynamic xml data?

Anonymous said...


I have started using loadrunner8.0 recently. And I am facing a problem in correlation.

Server is sending xml data back to the client and each time this data is different. After selecting a dynamic value from this xml data, I right clicked, but i am not getting "Create Parameter" option.

How can i apply correlation on these dynamic xml data?

Dmitry Motevich said...

Please, provide additional info:
- what LR protocol do you use?
- how do you try to perform correlation? (send screenshot)
- also, send me (if it's possible) a page, returned by server.

Anonymous said...

Thanks, this is really a good informative piece on corelation. Wish to see some more from you, possibly one with ViewState example.

Thanks again,

Dmitry Motevich said...

OK, I'll try to prepare an article about correlating ViewState.

Anonymous said...

Hi, can u also explain auto correlation. Is by doing auto correlation will solve problems always.

Anonymous said...

Is there any specific error loadrunner throw when running script again without correlation?
Thanks in advance

Dmitry Motevich said...

No any specific. Actually, if you didn't correlated LR script, you can face problems with authorizations, also some resources (pages, files) can be unavailable and server can return 404 HTTP error.

Anonymous said...

Thanks Man
This article explained everything about correlation.

Raaja Ramesh said...

Dmitry.. Excellent,
You are Rocking.. I'm new to LR, Wonderful Blog.. I never seen such a useful tutorials with realtime examples, I Recommeded for Most of frieds, who are into LR..

Wonderful Job.. Looking forward for Many useful examples..

Good Work.. Keep Up..

Raaja Ramesh

poonam said...

Thanks a lot for ur information.It really very helpful.M very grateful to you for clearing my doubts about coorelation.I am new to laod runner and it helped me a lot.I do have have some other doubts about load runner.If you could provide me with ur contact info.I would be very grateful to you.My email id is once again.

poonam said...

Thanks a lot for ur information.It really very helpful.M very grateful to you for clearing my doubts about coorelation.I am new to laod runner and it helped me a lot.I do have have some other doubts about load runner.If you could provide me with ur contact info.I would be very grateful to you.My email id is once again.

Anonymous said...

Your explanation is brilliant. Thanks for all the good work

Can you post a similar one View State please.


Dmitry Motevich said...

Give me a link of site which uses ViewState, and I will prepare visual (or even video) tutorial.

Sonny said...

dmitry, can you point us to the article regarding the automation of correlations. Thanks

Dmitry Motevich said...

Sonny (from September 3),

What do you mean with "automation of correlations"?
It seems that you should read LoadRunner Help on Correlation Rules (See "Recording Options" dlg, HTTP properties/Correlation)

sumit said...

Nice explanation on CORRELATION.Keep doing good work :)

I am not getting dynamic values in the response of previous explained in ur example i am having correlation problem with checksum and timestamp.timestamp i can parameterize but cheksum can't.

if u need extra explanation on my script please mail me on, i will send my script to you and detail about the problem.

Sumit Arneja

Dmitry Motevich said...

to Sumit Arneja (September 11),
Please send your issue to LoadRunner group.

Vaishaali said...

Hi Dmitry,

Thanks for over simplified explanations on correlation. I tried learning correlation from various sources but the information provided here is best !!

Vaishaali said...

Hi Dmitry,

Thanks for over simplified explanations on correlation. I tried learning correlation from various sources but the information provided here is best !!

Sajid said...

Hi Dmitry,
Great Explanation. I have just started learning Loadrunner and I found your input very helpful. Everything is described perfectly. Thanks a lot and keep up the good work.

rajvi said...

Can you tell me how can i corelate "JsessionId" in the script?

I followed your tutorial about correlation and able to capture the valuse.

But when i try to run the script, it does not move pass the first page.

Dmitry Motevich said...

Since you asked too general question, I provide the same general answer - "Use the approach explained in the above article"

Anonymous said...

Its excellent article by Dmitry:

Dilip (Pune -india)

Neetha said...


Nice Tutorial. Very brilliant language used. Also the example given is perfect, including all do's and dont's...Thank you so much...

Anonymous said...

Bharath here.I have an issue.In my LR script the dynamic data that is generated is so huge that i am unable to capture it in to a parameter using correlation technique.I even specified the highest value within web_set_max_html_param_len() function (after which we get memory violation error) and checked, even that doesn't solve the problem.Plz, provide me an alternate solution.
Note:the dynamic data that is generated in present run is completely different from the previous one.

chicha said...

I need to correlate a dynamic value in the script

The request has the dynamic value and the response from the server is error present =false.....

If i right click on the dynamic value in the body of the request the create parameter option is grayed out.

Can you help me out


qualityking said...

Hi Dmitry,
LoadRunner Recording Log gives extended output is there any ways to restrict it only up to Request Header and Response Header, sometime body size is too big and Image and flash output is meaning less so analyzing Recording Log takes too long

Manish Bansal

Dmitry Motevich said...

There is not a such way.

Dmitry Motevich said...

@ Anonymous (October 31, 2008),
Please send your question to LoadRunner group

Anonymous said...

Hi Dmitry,

Suppose i capture a dynamic number say 123456 from server using web_reg_save_param. But i want to use 123 only. How can we that?

Anonymous said...

Hi Dmitry,

We can select left boundary(LB)for a dynamic value either from script or generation log. Of the two, which is the best place to find LB?

Rahul_Test77 said...

Its Simpply Gr8. :)

Dmitry Motevich said...

Actually, both ways are equal - Script (I think, this is a source code of server response) or Generation log.
So, it's up to you which one to use.

As for me, I prefere to correlate values from a source code of server response. In this case, LR can calculate 'Ord' argument of web_reg_save_param function.
Now, I'm creating a video explaining this way of correlation. So, it will be publishing by the middle of November.

Dmitry Motevich said...

@Anonymous (November 4, 2008 7:31 PM),
Capture 123456 and use first 3 characters.

Dmitry Motevich said...

Please send your LR questions to LoadRunner Group

Anonymous said...

i learnt how to co-relating, thank you very much.
now i have problem while running the script in PerformanceCenter; the responses are not retriving/loging from the server in which my web_reg_save_param is supposed to search a value for co-relation.
script work perfectly when it is run in VuGen.
please let me know your thoughts on this Dmitry...

Anonymous said...

This provides clear way to understand correllation

Dmitry Motevich said...

@Anonymous (February 5, 2009),
Thank you.

Dmitry Motevich said...

Dear Readers!
Thank you very much for you comments!

Since this article was published more than one year ago, I've just disabled an adding of new comments for the article.