‘web_reg_save_param’ is a LoadRunner function which is used to handle the dynamic values coming from the server in the response. The basic concept of the dynamic value has already been covered in the ‘Correlation – Overview‘ topic. Moving ahead you also got the knowledge of the type of correlation i.e. Autocorrelation and Manual Correlation.
In Autocorrelation, VuGen adds ‘web_reg_save_param’ function in the script when you click the ‘Correlate’ button for suggested dynamic value. In Manual correlation, you have to manually add the same function at the right place, so that LoadRunner captures the dynamic value from the response and passes in the subsequent requests.
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). Hence it is named as ‘web_reg_save_param’.
Follow the navigation to open web_reg_save_param input box:
- Press ‘Ctrl+Alt+B’ or View -> Steps Toolbox
- Type ‘web_reg_save_param’ in the search box. VuGen will show the matched content.
- Double click on ‘web_reg_save_param’ function. The window will appear with the following inputs:
Attributes of ‘web_reg_save_param’:
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
- Use # for any digit (/DIG): Wildcard for digits
- Use ^ as a wildcard for (all, lowercase, uppercase) alphanumerical characters:
- all (ALNUMIC): To ignore the case
- lowercase (ALNUMLC): To match the lower case only
- uppercase (ALNUMUC): To match the upper case only
d. Instance (ORD): This is an optional attribute. It is used to capture dynamic value on a specific occurrence. If you specify the value of Instance (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("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:
e. Relative 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.
f. Not Found (NotFound): This is an optional attribute and the default value is “NotFound=error”. 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.
g. Search in (Search): This is an optional attribute with default value “All”. The scope of the search—where to search for the delimited data. The possible values are:
- All: The scope of search is body, headers, and resources
- Headers: It indicates to search only in the headers
- Body: The scope of the search is only body, not headers
- NoResource: The scope of the search only the HTML body, excluding all headers and resources
h. 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. It’s default value is –1 which instructs to save to the end of the string from the offset.
i. Save Offset(SaveOffset): This is an optional attribute and it’s 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.
j. IgnoreRedirections: This is an optional attribute with default value ‘No’. The possible values are:
- 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.
- No: LoadRunner even searches the existence of dynamic value in the response of the redirected request.
k. Convert: This is an optional attribute. 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
Example: ‘web_reg_save_param’ with all attributes:
web_reg_save_param("c_custID", "LB/BIN/DIG/ALNUMIC=customerID=", "RB/BIN/DIG/ALNUMIC=;", "Ord=1", "SaveOffset=2", "SaveLen=8", "NotFound=ERROR", "Search=Body", "RelFrameId=1", "IgnoreRedirections=Yes", LAST);
How to use web_reg_save_param 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 -> (Double Click on) web_reg_save_param -> ‘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 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:
1 thought on “web_reg_save_param”
The first one is correct.