web_reg_save_param_ex
The ‘web_reg_save_param’ function for the C language version of Micro Focus LoadRunner has been deprecated and replaced by the ‘web_reg_save_param_ex’ method. This is the ‘web_reg_save_param’ function in an expanded format with new significant attributes. By comparing the differences between the two, you can understand why some more features have been eliminated.
‘web_reg_save_param’ and ‘web_reg_save_param_ex’ differ in the following ways:
- The CONVERT attribute of web_reg_save_param allows conversion from HTML to URL or Text formats. ‘web_reg_save_param_ex’ does not support this attribute. If you need this feature, save the dynamic value to a parameter using web_reg_save_param_ex, and then format the parameter using web_convert_param.
- While “web_reg_save_param” has a wildcard character or digit choice in the LB and RB attributes, “web_reg_save_param_ex” has a wildcard option with “Content-Type” and “Request URL” in the “Filters” section.
- ‘web_reg_save_param_ex’ accepts regular expression boundary qualifiers (/RE) in some versions whereas ‘web_reg_save_param’ does not.
- ‘web_reg_save_param_ex’ now has a “DFEs” (Data Format Extension) argument attribute to decode or convert data formats. List of LoadRunner DFEs that have already been declared, but ‘web_reg_save_param’ lacks this attribute.
- ‘Filter’ is a separate part in ‘web_reg_save_param_ex’ that has certain extra properties like Header Name, Request URL, Content-Type, etc.
- The ‘Not Found’ attribute of ‘web_reg_save_param’ is changed to ‘Warn if the text was not found (Default is Error)’ in ‘web_reg_save_param_ex’. In the ‘web_reg_save_param_ex’ function, the checkbox has taken the position of the selection box.
Why does the function name look this way?
The web protocol (referred to as “web”) uses the web_reg_save_param function. By using the “reg” symbol, this function registers a request to determine the dynamic value depending on the boundaries. The dynamic value must then be saved in a parameter (indicated by “save_param” words) after the request has been registered. ‘_ex’ has been included because this is an expanded version of ‘web_reg_save_param’. This is why it is called “web_reg_save_param_ex.”
Open the web_reg_save_param input box by following the navigation:
- ‘Ctrl+Alt+B’ or ‘View -> Steps’ will be required. Toolbox
- ‘web_reg_save_param_ex’ should be typed into the search field. VuGen will display the content that matches.
- ‘web_reg_save_param_ex’ function should be double-clicked. The following inputs will be available in the window:
Figure(1)
‘web_reg_save_param_ex’ has the following characteristics:
- parameter: The name of the correlation parameter that will be used to hold the dynamic value. This field must be filled out.
- Left Boundary (LB): This symbol denotes the dynamic value’s left boundary. It uses all of the characters from the beginning of the data as a boundary if you do not give an LB value. This quality is required.
- Right Boundary (RB): This symbol denotes the dynamic value’s right boundary. To ensure that LoadRunner captures the correct dynamic value, the left and right boundary pair must be distinct. It uses all characters up until the end of the data as a boundary if you do not specify an RB value. This quality is required.
In addition to the border text, the LB and RB properties feature several text flags that aid in customizing and refining the search:- 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 qualifiers due to the alternate option of correlation function using the regular expression ‘web_reg_save_param_regexp’.
- DFEs: This attribute is optional. It is a list of Data Formats Extensions that should be used prior to doing the necessary search operation, each entry separated by a comma.
- Ordinal (ORD): This attribute is optional. It’s used to record dynamic values for a particular occurrence. All occurrences of the matching boundary are recorded in an array if you specify the value of Ordinal (ORD) = All. The ParamName_index identifies each element of the array individually. The parameter name in the example below is c_custID:
web_reg_save_param_ex(“c_custID”,
“LB=customerID=”,
“RB=;”,
“Ord=All”,
LAST);
The c_custID_1 value is saved for the first match, the c_custID_2 value for the second match, and so on. Using the ParamName_count argument, you may get the total number of matches. For instance, you can use the following sentence to retrieve the total number of matches saved to the parameter array:
customerCount=atoi(lr_eval_string(“{c_custID_count}”)); - Save Offset (SaveOffset): This optional feature has the value 0 (zero) by default. To save a part of the dynamic value to the parameter, use the offset option. A non-negative offset value is required.
- Save Length (SaveLen): This parameter is optional. It is useful to determine the length of the string from the correct offset before storing it in the parameter. By default, the string is stored from offset to end, which is set to -1.
- Warn if the text cannot be found (default error) (NotFound): ‘Error’ is the default value for this optional parameter. When the defined limit does not match, this option responds by producing an empty string. The following input methods are available:
- ERROR: This is a default value. When a boundary is not found then LoadRunner highlights 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.
- Scope: The ‘Filters (SEARCH_FILTERS)’ option has this attribute. This attribute also has a default value of “Everyone” and is optional. Describes the response search parameters for the dynamic value. Entry options include:
- 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 is only cookies.
- HeaderNames: You must choose type ‘Scope’ as headers to enable this feature. You can enter a comma-separated list of HTTP response header names in this field, and LoadRunner will look for dynamic values only in the headers you specify. This quality is optional.
- RequestURL – Only responses to given requests are examined for dynamic values. The wildcard character * is acceptable in URLs. It is specifically used to map the value returned in the flex_amf_call response.
- ContentType (ContentType): When a response has a header with the specified ContentType value, LoadRunner looks for that dynamic value. The wildcard character * can be used in ContentType. This quality is optional.
- Frame ID (RelFrameID): This parameter is optional. The position of the HTML page in the hierarchy relative to the requested URL. Both ‘All’ and some are viable options.
- Ignore Redirection: The optional attribute with a default value of “No” is IgnoreRedirections. Tickets include
- 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 for the existence of dynamic value in the response of the redirected request.
‘web_reg_save_param_ex’ is an example. has all the qualities.
Figure (2)
web_reg_save_param_ex(
“ParamName=c_custID”,
“LB/BIN/RE=clientID=”,
“RB/BIN/RE=;”,
“DFES=JsonXml”,
“Not found=warning”,
“ordinals=1”,
“Save Offset=2”,
“SaveLen=5”,
SEARCH FILTERS,
“range=HEADERS”,
“headshots = dummy”,
“IgnoreRedirects=Yes”,
“RelFrameID=1”,
“RequestUrl=https://myperformancetestdummysite.com”,
LAST);
How does the script’s web_reg_save_param_ex function work?
- Determine the dynamic value of the script (how?)
- Look for the requested cursor so that you can see the dynamic value of the response.
- Insert with a right click. New Action -> Step Tools -> (Enter Keyword) WebRegSave Parameter Example (Two Clicks) WebRegSave Parameter Example A dialog titled “Save Data to a Parameter” appears. Enter the necessary information and then click “OK”.
EITHER
You can write the script quickly if you are familiar with the characteristics of the web_reg_save_param_ex function and the correct syntax.
LoadRunner also has four additional mapping functions. Click on the following link for more information:
- web_reg_save_param
- web_reg_save_param_regexp
- web_reg_save_param_xpath
- web_reg_save_param_json
- web_reg_save_attrib