Correlations

To make to test run as realistic as possible we need to make scripts dynamic. We can do that using parameterization and correlation.

How to find dynamic values:

We only correlate values which are dynamic. To find dynamic values replay the recorded script, if script fails then double click on the error in replay log it will highlight the request in script where it got fail. In that request see if there are values like session-id, view state. These are the values we should correlate. Another way is to record two scripts of same application flow but with different user-ids and compare them with the wdiff utility available in LoadRunner. Note the values which are different in two scripts and see if we are passing them in Vuser script request. These are the values we should correlate.

There are two ways of doing correlation,

Automatic Correlation: HP LoadRunner provides facility of Automatic Correlation. Replay the script once and then press Ctrl+F8, tool will automatically find values which are dynamic according to LoadRunner dynamic values rule. If you are recording banking and finance web application, most of the time Automatic Correlation doesn’t work. By doesn’t work I mean it say there are no values to correlate, but when we replay the script it gets failed, so in that case we have to do manual correlations.

Manual Correlation: In manual correlation we have to find the values which are dynamic like session-id, view-state and write web_reg_save_param() function to capture those dynamic values into a parameter and replace the occurrence of that value in sub-sequent requests with it.

There are three ways of doing Manual Correlation:

1. Using Generation Log:

First search the dynamic value in Generation Log. When you find it make sure that value is in response not in request. Copy the left and right boundary of that value.

Note: left boundary should be accurate, because if you misspelled the left boundary web_reg_save_param() function will get fail to find that value.

To find the request in whose response that dynamic value is coming. Press Ctrl+f, find keyword add event and note the below request URL or name because we have to put our web_reg_save_param() function right above that request.

When we put our web_reg_save_param() in the script it register the parameter to find the value with mentioned left and right boundary in the below request and save it in the parameter.

2. Using Tree View:

We can do the correlation using Tree view. Click on the Tree View button located on the top panel. It will show you the Page view, Request and response. Find the dynamic value in the response tab, then right click and create parameter.

It will automatically create web_reg_save_param() function. You can check it in the script view.

3.Using Replay Log:

if you are not able to do correlation Using Generation Log and Using Tree View, the last option is to use Replay Log. To do correlation using replay log go to log settings,

Enable all options present in extended log and run the script it will print everything from parameter substitution to the data returned by server in replay log. Then find the dynamic value in replay log, note that left and right boundary and double click on that value it will highlight the request in script. Put your web_reg_save_param() function above that request.

Replacing the original value with captured value:

The web_reg_save_param() function stores the captured value in the parameter we mentioned at the time of declaration. We have to replace all the original value with the captured value so that every time it will put the current value of session-id or view states not the value at the time of recording. To do this press Ctrl+H to find and replace, replace all the original values with name of parameter and flower braces.

Parameterization

26 Comments

  1. Mandar S says:

    Hi,

    I have to fetch one value using web_reg_save_param and copy that value to notepad.but I am not able to capture that value.I performed all the step mentioned above but still in runtime data it is shoing zero no. of occourance for that value which I want Capture..
    Can you help me out…??
    Thanks,
    Mandar

    • admin says:

      please recheck on left and right boundaries accuracy and try manually searching them in corresponding response body. If you are able to find it manually then web_reg_save_param() function should work properly.

  2. Binoy says:

    Hi,

    I have a scenario where I need to open a page and then for down loading an xml, i need to click on a link, which in turn open a pop up.The Page and pop up has two different session ids.

    The problem is that after opening the pop up, the session id is with one LB. Since after downloading the xml from the pop up, the pop up needs to be closed, there is the same session id used, but with a different LB. How to do Manual Correlation for this, as the LB for the same page is different? It is showing error as “No match found for the requested parameter “CorrelationParameter_1″. Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 256 bytes, use web_set_max_html_param_len to increase the parameter size [MsgId: MERR-35061]
    Action.c(61): web_submit_form(“Login.html;jsessionid=nSsdRBlJ2hTWhGWdsMvChkfFtYSRnxMjwjFyQ6drtnh2TsRTgyX0!-1177834601!NONE”) highest severity level was “ERROR”, 4690 body bytes, 687 header bytes, 70 chunking overhead bytes [MsgId: MMSG-26387] ” while running the load runner script.

  3. Nirav says:

    Hi Folks,

    Can any one of you please explain exactly how to find Left and Right Boundaries in the script with syntax. I am really having problems in manual co-relation. Thanks for your help in advance. :)

  4. Asif says:

    Hi All

    I have problem with dynamic correlation

    eg ccxx0022mmnn[ CAD6016 ] LR_Test_Final – Campaign Information

    I have to find value of CAD where LB and RB I can get but value ccxx0022mmnn is a dynamic value how can i capture this could you please help me ?

    I am doing it like this

    web_reg_save_param(“ParmNo”,”LB= XXX [“,”RB=] {CampaignName} – Campaign Information”,LAST);

    I am not getting what i have to add in place of XXX in above script line, Please help me

    Thanks in advance
    Asif

  5. Mani says:

    Hello admin,

    Superb article on correlation. well, I have a scenario in which I wanted to know how to handle to.
    It is, depending on the value you give in the text box the Left and Right boundaries will change. I mean, suppose if I enter date in a text box, the left and right boundaries change.
    how to handle this situation in writing the left and right boundaries ?

    Thanks in advance,
    Mani

    • admin says:

      Hi there,
      If your left and right boundaries are changing then you can use web_reg_save_param_regexp() function. You have to write regular expression to catch the required value. Let me know if you need my help in writing regular expression.

  6. Raj says:

    Newbie here… Can i start(Continue) the recording from where i left in the application at a later time… Please let me know.. Our scenario’s are huge(like 100 pages end to end) and sometimes the app would logout after 80% completiong without any warnings.. we end up wasting 2 hours every time..

  7. yv raman says:

    Sir, i wanna know about regular expressions, please tell me about that.

    thanking sir,

  8. yv raman says:

    i am not understand how it will write regular expressions

  9. dpreddy says:

    Hi Admin,
    how to write regular expressions?
    when we write regular expressions?
    why we write regular expressions?

  10. Tuna says:

    Hi,

    I recorded the script using SAP web protocol.I found that the JSessionID needed corrleation.In script the jsession id generated as LykHIlFepR1osVJ3fKHYopHwaCx-QQGmwzEA_SAP.The same value being genetred in the first response from the server.So I inserted Correlation before this transaction in the script (here web_url).But while checking the next respose section, I found that the jsession value going to the server is “LykHIlFepR1osVJ3fKHYopHwaCx-QQGmwzEA_SAP2fy9hMxzOE9iUDmioK6eUnOt”.Some vlaue appended after the intial captured response sessionid.

    I have done the correlation like the following way.But LR is throwing the error message vuser_init.c(24): Error -26377: No match found for the requested parameter “jsessionid1″. Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 99999 bytes, use web_set_max_html_param_len to increase the parameter size [MsgId: MERR-26377]
    vuser_init.c(24): Notify: Saving Parameter “jsessionid1 = “.

    Correlation
    ==========
    “Web_reg_save_param(“jsessionid1″,”LB=JSESSIONID=”,”RB=\””,”ORD=1″,”Search=Body”,LAST);

    Please help me in doing the correlation for the jseesionid.

  11. Bobby says:

    Hi

    Iam new to Loadrunner and could be please explain in detail about regular expressions in correlation concept and also correlation arguments like savecount and savelength

  12. Bobby says:

    OOPS..Sorry could you please explain about saveoffset and savelen arguments in correlation

  13. Manjukumar says:

    I turned on the feature that the system passes new session id on every new session. So I recorded a script with the flow below,
    1. Login to the application
    2. Search for the flight availability
    3. Book a flight
    4. Log off from the application
    I replayed the script but the replayed snapshot is not shown for search for the flight page. When I tried to find the usersession in replay, it is not found. It was working fine at the first time when I did and I was able to see both recorded and replayed snapshots for all the steps in flows. Also I was able to correlate the usersession by creating parameter. Please let me know why the snapshot is not shown for a particular step in the flow.

  14. sid says:

    web_reg_save_param_regexp < will it supported in java over http protocall . i have script which first ineed to corelate in web then converted to java over http . am working on some old fashoned applets application but using LR11.52 verstion. pls suggest me some website or post on this.

  15. Need help says:

    I have U2_7_Q_30006_49″:{“id”:6859,”value”:”1000″,
    Need to correlate 1000 but 6859 keeps changing , i tried a regxp as below , still not able to capture , what am i missing?

    web_reg_save_param_regexp(
    “ParamName=corramountvalue”,
    “RegExp=\”Q_30006_49\”:{\”id\”:(….)+\”,\”\”value\”:\”\”,\”\”\””,
    SEARCH_FILTERS,
    “Scope=ALL”,
    LAST);

  16. eswar says:

    Please explain how to write RegExp

  17. krishna says:

    when my LB is keep on changing with no fixed length ,how i will do correlation
    please help me in choosing left text and right text…

    ABC R12 XYZ
    ABC RR1212 XYZ
    ABC RT13M XYZ
    ABC TTy1GM XYZ

  18. Pradeep Babu says:

    Hi Admin,
    Nice artictle. I have a question here. My web_reg_save_param() is correctly capturing the value- where I can see that in the run time viewer.

    But the repaly log shows only this one “Registering web_reg_save_param” is successful message and not showing
    “Registered web_reg_save_param is successful”

    I have even used Extended log in the Run time settings.

    Please help

    Thanks
    Pradeep

Leave a Reply