The test script uses the LoadRunner function web_reg_find as a content check function.
- By looking for an anticipated text string, this function assists in confirming whether or not the page you received is the required one.
- Web_reg_find’s return value simply tells whether registration was successful; it does not also state whether the check was successful.
- You can perform a text search by either specifying a single text or by specifying the text’s perimeters (using a tool like Correlation).
- Text and a prefix-suffix pair cannot be specified at the same time.
- Both HTML and URL-based scripts can use this function.
Why does the function name look this way?
Web protocol, identified by the prefix “web,” uses the web_reg_find function. By using the’reg’ symbol, this function registers a request to look up a text string. Finding and validating the text string on the web page received by the next action function (represented by the term “find”) comes next after registering the request. This is why it is called “web_reg_find.”
How does a script add the web_reg_find function?
While Being Recorded:
1. Choose the text you wish to use as a text check on the website while you are recording the script.
2. Select the VuGen floating bar’s ‘Insert Text Check’ button.
3. The script will be updated to include the web_reg_find() method that contains the chosen content. The text check function (web_reg_find) is always added by VuGen before the web page request containing the selected text. The text check function is placed in the same location in the script as the correction routines.
Post Recording:
- Find the cursor in front of the page request transaction if you wish to apply the content check.
- To open the Steps Toolbox, go to the menu and choose View -> Steps Toolbox (or press Ctrl+Alt+B).
- Input “web_reg_find” into the Steps Toolbox.
- The ‘web_reg_find’ function will be displayed in the search results. On it, click twice.
- Fill out the ‘Find Text’ input box with the value. For information on the inputs, you must enter in the dialogue box, see the attribute portion of this post below.
- Click ‘OK’ six times.
‘web_reg_find’ attributes include:
The ‘Find Text’ feature offers two different search choices. You can select any one of these depending on the text’s Text String or Text Boundary type.
a. specific text: Use the option to search for a specific text phrase if one is provided. Welcome, payment information, a customer form, etc. Using text flags, such as match case, binary data, use # for any digit, use a wildcard, etc., you can further tailor your search.
b. Search for Text by Start and End of text: This option is used when you are unsure of the text ahead of time but are aware of the strings that will come before and after it. As an illustration, consider the case where a user puts an order and the server replies with a text string and the order number as follows: “Your order number is order_number>. I’m grateful. Each user that placed an order successfully has a different order number. To verify that the order has been placed, it is sufficient to verify that there is some string that is followed by “Thank you!” and preceded by “Your order number is “.
Hence “Your order number is” would appear in the Start String and “would appear in the End String. I’m grateful.
Using text flags, such as match case, binary data, use # for any digit, use a wildcard, etc., you can further tailor your search.
c. Search in (Search): This is a choice property with the default value of “All.” where to look for the delimited data within the search’s scope. Possible values include:
- All: The body, headers, and resources make up the search’s coverage area.
- It says to only conduct searches in the headers.
- Headers aren’t included in the search; just the body is
d. SaveCount: The variable’s name will be used to save the number of matches that were discovered in the response (or web page). There are two uses for this quality. To determine whether a string is found or not, and if so, how many times? Using an if condition, you can pass or fail a transaction by using the SaveCount argument. See the illustration from the mercury site below:
d. Fail if: For instance, searching for “500/Internal Server Error” or just “Error,” etc.
- Notfound indicates that an error occurs when the text is not found. You use NotFound when searching for the text you expect to find if the Web request succeeds. Example: Title of the page, Your Order Number, etc.
- Found indicates that the check fails when the text is found. Example: Searching for the word β500/Internal Server Errorβ or only βErrorβ etc.
Note: When using both SaveCount and Fail, the given Fail handling option cooperates with SaveCount. The check is successful if SaveCount is used with “Fail=NotFound” and the text is located because the SaveCount option is given the number of occurrences. The SaveCount argument is set to “0” and the check fails if the text cannot be found. Of course, the parameter value “0” is only useful if the Continue on error, if the text cannot be retrieved runtime setting, is selected and “Error = Not Found” is set.