Tuesday, 15 September 2015

The Correlation and web_reg_save_param() in load runner

What is Correlation?

It is nothing but to capture the dynamic data information from a server to a parameter.

What is Session id?
Session id is created by the server for security purpose.all the session id are dynamic only. These values can be created by server.some of the usual dynamic values are view state,Event validation, Image Id, Dynsess,Object Id etc.

To find out the dynamic value in a scenario,we need to create the two  identical scripts of same business scenario and compare the scripts each and every line.we can compare using load runner default win diff or any other third party tool.Then we can see the difference in the dynamic values in the yellow lines

Web_reg_save_param (const char “Param_Name”, <List of Attributes>, LAST); 
List of Attributes in correlation 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.

Case1: 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 (34): Notify: Parameter Substitution: parameter "outFlightVal" = "240; 355; 10/25/2015" */

Dynamic session handling:
  • 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
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
Syntax: Web_reg_Save_Param(“ParameterName”,”LeftBoundary”,”RightBoundary”,”ORD",LAST);

What is LB? What is RB? How did you get it?
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.
               
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. 

When will you use manual correlation?
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.

Where the correlation functions will be replaced?
Before submitting the form or data. Where we are giving input before that we are putting the function.

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.

How did you do correlation?
Automatic correlation and manual correlation.

Note: After scanning or running of the script, we will get same 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.

Correlation:
1. go to generation log and press Cntrl + f    -> find
2. Cntrl + H-> find & replace, f3 -> to go for next session value
3. press F3->Next search -> forward search
4. Shift+F3-> backward search
5. Ctrl +s ->to save



LoadRunner Training in Bangalore
LoadRunner Training in Hyderabad
LoadRunner Online Training
LoadRunner Training in BTM
LoadRunner Training in Marathahalli
Best LoadRunner Training Institutes in Bangalore 
Best LoadRunner Training Institutes in India
Training Institutes in Bangalore

1 comment: