web_reg_save_param_ex

web_reg_save_param_ex

web_reg_save_param function is deprecated from 12.5 version of Loadrunner. Therefore web_reg_save_param_ex and web_reg_save_param_xpath is introduced. Here we will see about web_reg_save_param_ex function and its attributes.

 Syntax :

web_reg_save_param_ex("ParamName=<output parameter name>", [LB[/IC][BIN]=<value>, ][RB[/IC][BIN]=<value>, ] <List of Attributes>, <SEARCH FILTERS>,LAST );

Example : 

web_reg_save_parama_ex

Most important list of attributes present in the function.

ParamName:

  • It store the dynamic values in the specified variable which is found using the attribute.

LB:

  • Left boundary of the dynamic value which we need to capture.
  • If the LB is empty, then it will capture all the characters from the starting of the boundary.
  • It is case sensitive, therefore when you are specific the boundary make sure they are exactly same as it is displayed.
  • One can further customize the search text, by using one or more text flags.
  • Its the most important attribute is mandatory.

RB:

  • Right boundary of the dynamic value which we need to capture.
  • If the RB is empty, then it will capture all the characters from the starting of the boundary.
  • It is case sensitive, therefore when you are specific the boundary make sure they are exactly same as it is displayed.
  • One can further customize the search text, by using one or more text flags.
  • Its the most important attribute is mandatory.

List of Attributes :

Most important attributes used in this section.

  • ORD:
    • It will Indicates the ordinal position of the dynamic value or instance of the match of the value.
    • If you specify as "All," it saves the parameter values in an array.
    • Default value of the instance is 1.
    • This attribute is optional.
  • NOTFOUND :
    • It used to handle when the boundary is empty string in the response.
    • "Not found=error" is the the default value. It will raise the error when a boundary is not found.
    • "Not found=warning" does not raise an error. Therefore "warning" option is ideal if you want to see if the string was found and you do not want the script to fail.
    • This attribute is optional as well.
  • SaveLen :
    • Length of the sub-string where the value is found, from the specified offset, to save into parameter.
    • Default value is -1, indicating to save to the end of the string.
    • This attribute is optional.
  • SaveOffset:
    • Offset of a sub-string where the value is found, to save into parameter.
    • Value must be non-negative.
    • Default value is 0.
    • This attribute is optional.

SEARCH_FILTERS :

Search Filters starts with the marker that is SEARCH_FILTERS. The SEARCH_FILTERS section is option, therefore we can use this when it is required only. Below are the most important specifiers used in this section.

  • ContentType:
    • Only responses with the specified ContentType header are searched.
    • Therefore this will search only the header section of the response.
    • The ContentType can contain the * wildcard.
  • HeaderNames:
    • We can give a list  of HTTP response header names with comma-separated.
    • Therefore only the specified headers' values are searched in the response.
    • It will be applied only when the Scope is "Headers".
    • If no Ordinal value is specified, the first occurrence of a match of the LB and RB is found.
  • Ignore Redirections:
    • If you set the attribute "Ignore Redirections=Yes", then if the server response contains any redirection information like (HTTP status code 300-303, 307). The response is not searched. Instead, once the redirection response is received, the GET request is sent to the redirected location. And the search is performed.
    • Therefore the default value is "Ignore Redirections=No".
    • This attribute is optional.
  • RelFrameID :
    • It specific the hierarchy level of the HTML page which is related to the requested URL.
    • Default value is ALL.
    • This attribute is optional.
  • RequestURL:
    • Only responses to this request are searched.
    • The URL can contain the * wildcard.
    • Therefore you can specif any wildcard in this section.
  • Scope:
    • Most important section is to specific where you need to search for the delimited data.
    • The possible values are:
      • All- Search the entire buffer.
      • Headers - Search only the headers.
      • Body - Search only body data.
      • Cookies - Search only in cookies.
    • This attribute is Optional.

Difference between parameterization and correlation?

Difference between parameterization and correlation

Parametrization :

  • Parameter is a container which is used to hold the values that are used in Vugen script.
  • Parameterization is used to send the different values(Unique values) to the Vugen script  from the parameter file.
  • It will help a single virtual vuser to use different data on each run.
  • Most important part that it is used to simulates real-life usage of an application as it avoids server from caching results.
  • There are different type parameter present in loadrunner.
  • Parameter will hold the value which is saved in the parameter files.
  • Main difference about parameter is that the values will be already present in the file even before the start of the script.
  • Therefore scripts will not fail because of not finding the values.

Click Here to read more about parametrization and its most important  attributes.

Correlation :

  • Correlation is a mechanism of handling the dynamic values passed from the server to the script.
  • It is important aspect which will let the script run end to end without any error.
  • There are two type of correlation which we can use in load runner.
  • Correlation value is captured from the response of the request and then the correlation value will passed to next request.
  • Therefore the script will run without any issues.
  • Dynamic values need to be handled in the script which will done using correlation.
  • Correlation values are captured during the script execution.
  • Therefore there is high chance that if the boundary are empty during the reply of the script. Then script might fail due to the error message.

Click Here to read more about correlation and its most important attributes.

web_reg_save_param Example

web_reg_save_param Example

Some of the examples which will cover the important attributes present in web_reg_save_param function.

Click Here to know about attributes of web_reg_save_param function.

Example 1:

<tr bgcolor=#66CCff><td align=center><input type = radio name=outboundFlight value=230;378;11/20/2003 checked >Blue Sky Air 230<td align=center>8am
<td align=center

  • We will see how we can capture the flight name which is highlighted in red color.
  • It will capture the values Blue Skg Air 230 in the C_Fightname parameter.
  • Ordinal is 1, which means the first occurrence of the value will be captured. Here the value Blue Skg Air 230 is the occurrence of the boundary.

web_reg_save_param("C_Fightname", "LB=checked >", "RB=<td align=center>", "ORD=1", LAST) ;

Example 2:

<tr bgcolor=#66CCff><td align=center><input type = radio name=outboundFlight value=230;378;11/20/2003 checked >Blue Sky Air 230<td align=center>8am
<td align=center

  • In this example, we will see how to use the Not Found and search attribute.
  • "Not Found = Warning" is specified in this example. Therefore when the response of the boundary is empty then the script will display warning but the script will stopped. But when you give as error then script will fail when the boundary values are empty.
  • Search is set "ALL" which means it will search every part of the response.

web_reg_save_param("C_Filghttime", "LB=name=outboundFlight value=", "RB=checked >", "ORD=1","NOTFOUND=Warning", "Search=ALL", LAST) ;

Example 3 :

  • In this example we will see how to use saveoffset, savelen and relframeid.
  • Savelen will save the length of the value.
  • Saveoffset will start the word as specific in the boundary.
  • Relframeid will let the boundary to search the frame where value might be found.

web_reg_save_param("C_Filghttime", "LB=name=outboundFlight value=", "RB=checked >", "SaveOffset=1", "SaveLen=1", LAST) ;

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