Micro Focus LoadRunner has deprecated ‘web_reg_save_param’ function for C language version and replaced it with ‘web_reg_save_param_ex’ function. This is an extended form of ‘web_reg_save_param’ function with new important attributes. Some more attributes have been removed which you can understand by referring to the differences between both of them.
Difference between ‘web_reg_save_param’ and ‘web_reg_save_param_ex’:
- ‘web_reg_save_param’ has a CONVERT attribute for changing from HTML format to URL or Text formats. This attribute is not available with ‘web_reg_save_param_ex’. If you require this functionality then use web_reg_save_param_ex to save the dynamic value to a parameter then use web_convert_param to format the parameter.
- ‘web_reg_save_param_ex’ has wildcard option with ‘Content Type’ and ‘Request URL’ in the ‘Filters’ section whereas ‘web_reg_save_param’ has wildcard character or digit option in LB and RB attributes.
- ‘web_reg_save_param_ex’ supports Regular Expression boundary qualifiers (/RE) in some versions whereas ‘web_reg_save_param’ does not support regular expression boundary qualifier.
- Added “DFEs” (Data Format Extension) argument attribute in ‘web_reg_save_param_ex’ to decode or convert the data format. List of pre-defined LoadRunner DFE whereas ‘web_reg_save_param’ does not have such attribute.
- ‘Filter’ is a separate section in ‘web_reg_save_param_ex’ with some additional attributes like Header Name, Request URL, Content Type etc.
- ‘Not Found’ attribute of ‘web_reg_save_param’ becomes ‘Warn if text was not found (Default is Error)’ in ‘web_reg_save_param_ex’. The selection box has been replaced with the checkbox in ‘web_reg_save_param_ex’ function.
Why the function name is like this?
‘web_reg_save_param’ function is used for web protocol (denoted by “web”). This function registers a request to find out the dynamic value based on the boundaries (denoted by “reg”). After registering the request, the next task is to save the dynamic value in a parameter (represented by “save_param” words). Since this is an extended form of ‘web_reg_save_param’ so ‘_ex’ has been added. Hence it is named as ‘web_reg_save_param_ex’.
Follow the navigation to open web_reg_save_param input box:
- Press ‘Ctrl+Alt+B’ or View -> Steps Toolbox
- Type ‘web_reg_save_param_ex’ in the search box. VuGen will show the matched content.
- Double click on ‘web_reg_save_param_ex’ function. The window will appear with the following inputs:
Attributes of ‘web_reg_save_param_ex’:
a. Parameter Name: The name of the correlation parameter to store the dynamic value. This is a mandatory field.
b. Left Boundary (LB): It denotes the left boundary of the dynamic value. If you do not specify an LB value, it uses all of the characters from the beginning of the data as a boundary. This is a mandatory attribute.
c. Right Boundary (RB): It represents the right boundary of the dynamic value. The left and right boundary pair should be unique so that LoadRunner captures correct dynamic value. If you do not specify an RB value then it uses all of the characters until the end of the data as a boundary. This is a mandatory attribute.
Apart from the boundary text, LB and RB attributes have some text flags which helps to make the search customize and precise:
- Match case (/IC): To consider or ignore the case
- Binary data (/BIN): To specify the binary data for boundaries
- Regular expression (/RE): To specify the regular expression. The latest version of LoadRunner may not support regular expression boundary qualifier due to the alternate option of correlation function using regular expression ‘web_reg_save_param_regexp’.
d. DFEs: This is an optional attribute. It is a comma-separated list of Data Formats Extensions that are to be used before the required search operation is to be performed.
e. Ordinal (ORD): This is an optional attribute. It is used to capture dynamic value on a specific occurrence. If you specify the value of Ordinal (ORD) =All then all the occurrences of the matched boundary are saved in an array. Each element of the array is represented by the ParamName_index. In the following example, the parameter name is c_custID:
web_reg_save_param_ex("c_custID", "LB=customerID=", "RB=;", "Ord=All", LAST);
The first match is saved as c_custID_1, the second match is saved as c_custID_2, and so forth. You can retrieve the total number of matches by using the following parameter ParamName_count. For example, to retrieve the total number of matches saved to the parameter array you can use the below statement:
f. Save Offset (SaveOffset): This is an optional attribute and its default value is 0 (zero). You can use the offset option to save a sub-string of the dynamic value to the parameter. The offset value must be non–negative.
g. Save Length (SaveLen): This is an optional attribute. It helps to define the length of the string from the specified offset to save to the parameter. Its default value is –1 which instructs to save to the end of the string from the offset.
h. Warn if text was not found (Default is Error) (NotFound): This is an optional attribute and has ‘Error’ as a default value. This option handles the situation when the defined boundary does not match and generates an empty string. It has the following input options:
- ERROR: This is a default value. When a boundary is not found then LoadRunner highlight it as an error in the log.
- WARNING: LoadRunner 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 good when you want to see whether the string was found or not, but do not want the script to fail.
Note: If ‘Continue on Error’ option 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.
i. Scope: This attribute comes under ‘Filters (SEARCH_FILTERS)’ option. This is also an optional attribute with default value “All”. It specifies the scope of the search of dynamic value within the response. The input options are:
- All: The scope of search is the body, headers, and resources
- Headers: It indicates to search only in the headers
- Body: The scope of the search is only body, not headers
- Cookies: The scope of the search only cookies.
j. Header Name (HeaderNames): To enable this attribute you need to select ‘Scope’ type as Headers. Here, you can provide a comma-separated list of HTTP response header names then LoadRunner will search the dynamic values only in the specified headers. This is an optional attribute.
k. RequestURL: The dynamic values will be searched only in the responses of specified requests. The URL can contain the * wildcard. It is specially used to correlate the value coming in the response of flex_amf_call.
l. Content Type (ContentType): LoadRunner searches the dynamic value in the responses with the specified ContentType header. The ContentType can contain the * wildcard. This is an optional attribute.
m. Frame ID (RelFrameID): This is an optional attribute. The hierarchy level of the HTML page relative to the requested URL. The possible values are ‘All’ or a number.
Note: GUI level scripts do not support RelFrameID.
n. Ignore Redirection (IgnoreRedirections): This is an optional attribute with default value “No”. The inputs are:
- Check (Yes): By setting the ‘IgnoreRedirections=Yes’, it instructs LoadRunner not to search the dynamic value in the response of the redirected request. You can identify the redirected request by its response code HTTP 3XX.
- Uncheck (No): LoadRunner even searches the existence of dynamic value in the response of the redirected request.
Example: ‘web_reg_save_param_ex’ with all attributes
web_reg_save_param_ex( "ParamName=c_custID", "LB/BIN/RE=customerID=", "RB/BIN/RE=;", "DFEs=JsonXml", "NotFound=warning", "Ordinal=1", "SaveOffset=2", "SaveLen=5", SEARCH_FILTERS, "Scope=HEADERS", "HeaderNames=dummy", "IgnoreRedirections=Yes", "RelFrameID=1", "RequestUrl=https://myperformancetestingdummysite.com", LAST);
How to use web_reg_save_param_ex function in the script?
- Identify the dynamic value in the script (How?)
- Locate the cursor before the request which has dynamic value in the response.
- Right click -> Insert -> New Step -> Steps Toolbox -> (Search for keyword) web_reg_save_param_ex -> (Double Click on) web_reg_save_param_ex -> ‘Save Data to a Parameter’ window will open -> Provide the required input and press Ok.
If you know the correct syntax and attributes of web_reg_save_param_ex function then you can simply type in the script.
Important Point: LoadRunner’s correlation functions are always written/placed before the request whose response contains the dynamic value.
In addition, there are four more correlation functions in the LoadRunner. Refer to the link to get more detail: