Monday 3 June 2013

How to do Correlation and web_reg_save_param() in load runner

The correlation id to capture the dynamic values which are coming from a server to a parameter.

Dynamic session handling
Session ID: Session id is created by the server for security purpose.These session id's are dynamic. These values can be created by server.some of the usual dynamic values are view state,Event validation, Image Id, Dynsess,Object Id etc.
  • Process of capturing a value dynamically and replacing it in the script during replay
  • To capture the dynamic values in each run of the script execution is called correlation.
  • To parameterize the server generated values

Process of correlation:
There are two methods of correlations,They are 

1. Auto Correlation,
2. Manual Correlation

1. Auto Correlation: Automatically the L R itself handles the process to capture the dynamic value in each run of the script execution.

  1. Create the script by disabling the correlation in the recording options. 
  2. Run the script for multiple times to get the error messages like Sessions expired, Session timeout or missing object id etc.
  3. Click on find correlation it displays the required dynamic values in the co relation studio. 
  4. Select the value to be correlated and Click on correlate tab in the toolbar.
  5. The Correlation Function will be inserting in appropriate place of the script as shown in below
            
Manual Correlation:
  1. Create the 2 identical scripts and save those 2 scripts in windows temp directory. 
  2. Open any one of the script from the script go to Tools menu. 
  3. Select compare script for the comparisons, the difference between the two scripts will display in the Wdiff utility. 
  4. Identify the dynamic context charge between two scripts identically the Left & Right boundary of the dynamic values. 
  5. Search for the First occurrence of the dynamic values to replace by a given parameter name. 
  6. Select the position to insert the correlated function with all the parameters.
Try to run the script, the script should properly run without the script showing any error message for the dynamic handling. 

syntax:

Web_reg_save_param (const char “Param_Name”, "LB=","RB=","ORD=","Convert=HTML_TO_URL","Ignore Redirections=Yes","Notfound=warning","Savelength=",Saveoffset=", LAST); 
Attributes Description in the function:
LB: It is the left boundary of the dynamic value.   
RB: It is the gives the Right boundary of the dynamic value.
I will go to tree view then I will select server response from there I will select   the LB and RB as indicated.

Assign the name of the parameter which is related by the hard coded  dynamic values.
LB=Left boundary = Assigns the Left Boundary of the dynamic value.
RB = right boundary = Assigns the Right Boundary of the dynamic value.
Ord = ordinal value=Occurrence of the value.  It indicates the no of occurrences of the dynamic values.
Ex: if the occurrence is 1, ord = 1 or If the occurrence is 2 ord = 2 or If n no of occurrences then ord = all.
LAST = it come for each function at last time, it is end of the attributes. It indicates there is no any arguments which in the function.


Convert: The possible values are: 
HTML_TO_URL: convert HTML-encoded data to a URL-encoded data format

HTML_TO_TEXT: convert HTML-encoded data to plain text format this attribute is optional. 

Ignore Redirections: If "Ignore Redirections=Yes" is specified and the server response is redirection information (HTTP status code 300-303, 307), the response is not searched. Instead, after receiving a redirection response, the GET request is sent to the redirected location and the search is performed on the response from that location. 
This attribute is optional. The default is "Ignore Redirections=No".

LB: The left boundary of the parameter or the dynamic data. If you do not specify an LB value, it uses all of the characters from the beginning of the data as a boundary. Boundary parameters are case-sensitive. To further customize the search text, use one or more text flags. This attribute is required. See the Boundary Arguments section.

NOTFOUND: The handling option when a boundary is not found and an empty string is generated. 
"Not found=error", the default value, causes an error to be raised when a boundary is not found. 
"Not found=warning" ("Not found=empty" in earlier versions), does not issue an error. If the boundary is not found, it sets the parameter count to 0, and continues executing the script. The "warning" option is ideal if you want to see if the string was found, but you do not want the script to fail.
TIP: If Continue on Error is enabled for the script, then even when NOTFOUND is set to "error", the script continues when the boundary is not found, but an error message is written to the extended log file. This attribute is optional.

ORD: Indicates the ordinal position or instance of the match. The default instance is 1. If you specify "All," it saves the parameter values in an array. This attribute is optional.
TIP: The use of Instance instead of ORD is supported for backward compatibility, but deprecated.

RB: The right boundary of the parameter or the dynamic data. If you do not specify an RB value, it uses all of the characters until the end of the data as a boundary. Boundary parameters are case-sensitive. To further customize the search text, use one or more text flags. This attribute is required. See the Boundary Arguments section.

RelFrameID: The hierarchy level of the HTML page relative to the requested URL. The possible values are ALL or a number. Click RelFrameID Attribute for a detailed description. This attribute is optional.

TIP: RelFrameID is not supported in GUI level scripts.
SaveLen: The length of a sub-string of the found value, from the specified offset, to save to the parameter. This attribute is optional. The default is -1, indicating to save to the end of the string.

SaveOffset: The offset of a sub-string of the found value, to save to the parameter. The offset value must be non-negative. The default is 0. This attribute       is optional.
Search: The scope of the search-where to search for the delimited data. The possible values are Headers (Search only the headers), Body (search only body data, not headers), Noresource (search only the HTML body, excluding all headers and resources), or ALL (search body, headers, and resources). The default value is ALL. This attribute is optional.


  • Saving a single string in the request

//This Web_reg_save_param function call applies to the Web_submit_form function: . //
       
Web_reg_save_param (“FlightVal","LB=outbound Flight value=", "RB= checked >", LAST);

 Web_submit_form ("reservations.pl", "Snapshot=t4.inf", ITEMDATA,
              "Name=depart", "Value=Denver", ENDITEM,
              "Name=depart Date", "Value=10/25/2015", ENDITEM,
              "Name=arrive", "Value=London", ENDITEM,
              "Name=return Date", "Value=10/26/2015", ENDITEM,
              "Name=numPassengers", "Value=1", ENDITEM,
              "Name=roundtrip", "Value=<OFF>", ENDITEM,
              "Name=seatPref", "Value=None", ENDITEM,
              "Name=seatType", "Value=Coach", ENDITEM,
              "Name=findFlights.x", "Value=75", ENDITEM,
              "Name=findFlights.y", "Value=14", ENDITEM,
              LAST);
/*
The result of the web_reg_save_param having been called before the web_submit_form is: Action.c (14): Notify: Saving Parameter "FlightVal = 240; 355; 10/25/2015"
*/
// Now use the saved parameter value of FlightVal in to the below function

       web_submit_form ("reservations.pl_2",
              "Snapshot=t5.inf",
              ITEMDATA,
              "Name=outboundFlight", "Value= {FlightVal}", ENDITEM,
              "Name=reserveFlights.x", "Value=82", ENDITEM,
              "Name=reserveFlights.y", "Value=10", ENDITEM,
              LAST);
/*
Action.c (14): Notify: Parameter Substitution: parameter "outFlightVal" = "240; 355; 10/25/2016" */

Important points to remember:

  • Dynamic values will be encrypted sometimes, so we use manual correlation instead of automatic correlation.And it is the best way at all the times.
  • The correlation functions will be replaced Before submitting the form or data. Where we are giving input before that we are putting the function.there we the 
  • After scanning or running of the script, we will get some messages found like
1. No server found
2. No request found
3. Request link not found
4. Web link not found.

  • Then we will go to execution log and find out about these messages clearly.

26 comments:

Unknown said...

Hi ravi,
ur postings are good..
im a big fan of ur blog and using from past 8 months nearly.and im a new bie to load runner so could u please go brief about correlation im facing problem .im having offer with 4+.im feeling trouble in correlation. so can u guide me to get rid of this.
Hope u could understand my situation.
gettinh special charecters in lb and rb
even worked with "\"
Thanks in advance
Sri

Unknown said...

hi,
im a new bie to load runner could u please go a little bit deep in correalation.
like kb and rb changing and getting special charecter at middle with real time example

plz do reply to my mail id and do send me docs which u have
srisweety4u@gmail.com

Unknown said...

Hi, I have a question about correlation. How can i capture the last occurrence of the dynamic value using web_reg_save_param function?

Unknown said...

Loadrunner is a flagship automation load testing product from HP. This products command over 70 % of market share in load and performance testing tools. Nowadays, testing professionals strong in handling Loadrunner automation tool has huge career opportunity. FITA is the reputed institute offering Loadrunner training in Chennai

Unknown said...

hi sir, i have one question

what is the way to correlate the values stored in a drop down list? ex: in webtours application, there are a list of city names in departure city and arrival city drop down list. how to correlate these city names ?

Raviteja Gorentla said...

Hi Basavaraj..

Just you need to script the flow by clicking the one of the button in the drop down list.After this find out the left and right boundaries of the city name.Then you need to write the function web_reg_save_param("Flight","LB=","RB=",ORD=ALL,LAST);

Make sure you have to put ORD=ALL then it will display all the values of drop down list by Flight_1,Flight_2....Etc

Unknown said...

If I use ORD = ALL then it is showing all the values being assigned to outFlightVal_1, outFlightVal_2,... while running the script.
Now my question is how can I select one of it's value dynamically and pass to the submit_form method?
e.g.
int randValue = rand()% {outFlightVal_count} this will give me random number between 0 to outFlightVal_count. From this I can create parameter {outFlightVal_randValue}. How to pass this parameter to the submit_form method?
Please elaborate.
Thanks.

gpunjot said...

Can somebody help me to write the text save using web.reg_save_param.
I am doing scripting using Java Vuser protocol.

While C vuser protocol, I was able to directly write the value found in web_reg_save_param using file pointer.

Unknown said...

hi sir, could you explain the correlation functions introduced in loadrunner 11.0,

web-reg_save_param_ex,

web-reg_save_param_xpath,

web-reg_save_param_regexp.

Raveen said...

Hi All,
Can anybody please tell me how will be the scripting for the payment transaction?
For ex. when i click on payment button, request will go for authentication and it will take time to process the payment, after certain amount of time server send the response with payment successful message.

I'm unable to visualize the the step when payment submit button click, mean after submitting the request on the page we see the message 'Payment authentication is in progress' so does that mean we are continuously getting response from the server or if not how it is and how we can proceed for the scripting?

Anonymous said...

Thanks for thati have to lot on message.hadoop training chennai

Unknown said...


Your posts is really helpful for me.Thanks for your wonderful post. I am very happy to read your post.very nice !!! CCNA training in chennai | CCNA training chennai | CCNA course in chennai | CCNA course chennai

Anu Sri said...

Thanks for this valuable tutorial. It was really helpful and I was able to learn some few things also. So thanks.

download lucky patcher no root apk said...

Very Nice Article.. Great work.. Keep posting... Thank you...

marry said...

Thank you for sharing such great information very useful to us.
Loadrunner Training in Delhi

Sai Elakiyaa said...

Thanks for making this guide and you have given such a clear breakdown of technology updates. I've seen so many articles, but definitely, this has been the best I?ve read!
Selenium Training in Chennai
software testing selenium training
iOS Course in Chennai
iOS Training Chennai
Java training institute in chennai
Best JAVA Training institute in Chennai


Unknown said...

Thanks for sharing,this blog makes me to learn new thinks.
interesting to read and understand.keep updating it.
Java Training in Bangalore
Java training courses near me
Java Training in Vadapalani
Java Training in Perungudi

Anjali Siva said...

Useful blog admin, really helpful to me.
DevOps certification Chennai
DevOps Training in Chennai
DevOps Training institutes in Chennai
Blue Prism Training Chennai
RPA courses in Chennai
Angularjs Training in Chennai

Unknown said...

Thanks for your efforts in sharing this information in detail. Kindly keep continuing the great work.

Best Oracle Training Institute in Chennai
Best Oracle Training in Chennai
Oracle Training Center in Chennai
VMware Training
Vmware Training center in Chennai
VMware Training institute in Chennai

Xplore IT Corp said...


Hey Nice Blog!! Thanks For Sharing!!!Wonderful blog & good post.Its really helpful for me, waiting for a more new post. Keep Blogging!
networking training
ccna Training

Anjali Siva said...

Wonderful post. Thanks for taking time to share this information with us.
UiPath Training in Chennai
UiPath Training in Tambaram
AWS course in Chennai
Robotics Process Automation Training in Chennai
ccna course in Chennai
Angularjs Training in Chennai

LindaJasmine said...

Amazing Post. Great write-up. Extra-ordinary work. Waiting for your next Post.
Social Media Marketing Courses in Chennai
Social Media Marketing Training in Chennai
Social Media Training in Chennai
Social Media Marketing Training
Social Media Marketing Courses
Social Media Training
Social Media Marketing Training
Social Media Courses

LindaJasmine said...

Awesome Writing. Wonderful Post. Thanks for sharing.
Blockchain certification
Blockchain course
Blockchain courses in Chennai
Blockchain Training Chennai
Blockchain Training in Porur
Blockchain Training in Adyar

Unknown said...

Hi,
My question is if I am using web_reg_save_param and using save offset with this.
For example the string is "ABCDEFGHIJ"
AND I using we_reg_save_param("name", "LB=ABCD", "RB=GHIJ", "saveoffset=3", LAST);
What happen when I give more offset value then the length of the parameter

Jaya said...

Such a great blog.Thanks for sharing...
DevOps Training in Bangalore
Devops Training in Pune
Devops Training in Hyderabad
Devops Training in Gurgaon

Reshma said...

This blog is really awesome. I learned lots of informations in your blog. Keep posting like this...
IELTS Coaching in Bangalore
Best IELTS Coaching in Bangalore