web_global_verification

web_global_verification is a LoadRunner inbuilt function which is used to define a global text check to verify the presence of a specific text or text string in the subsequent web pages.

  • This function helps to verify whether the received response (web page) has specific text or text string or not. 
  • You can search the text or text string globally either by specifying the text or by the boundaries of the text. 
  • You can not specify both text and a prefix-suffix pair in the same function. 
  • This function can be used for both HTML-based and URL-based scripts.
  • web_global_verification function is used globally to verify the specified text string on all the subsequent (web page) request functions while the web_reg_find function only registers a request for the next action function.
  • You can add multiple web_global_verification functions in a script provided that all the requests should satisfy the content check.
  • The global content check can be paused and resumed using web_global_verification_pause and web_global_verification_resume functions respectively.

Why the function name is like that?

web_global_verification function is used for web protocol (denoted by ‘web’). This function searches and verifies (represented by ‘verification’) a text or a text string in the response of the web pages returned by all the subsequent requests in the script i.e. globally (denoted by ‘global’). Hence it is named as ‘web_global_verification’.

How to add the web_global_verification function in the LoadRunner script?

It is recommended to add the web_global_verification function at the beginning of the script under the vuser_init or Action section so that the check can be applied on all the web pages. Follow the below steps to add the function:

1. Locate the cursor where you want to add the web_global_verification function.

2. Go to Menu then select View -> Steps Toolbox (or Press Ctrl+Alt+B) to open the Steps Toolbox.

3. In the Steps Toolbox, type ‘web_global_verification’

4. The search result will show you the ‘web_global_verification’ function. Double-click on it.

5. Enter the value in the ‘Global text find’ input box. Refer to the attribute section below in this post to understand what inputs you need to provide in the input box.

6. Click the ‘OK’ button.

web_global_verification input box
Figure 01: ‘web_global_verification’ input box

Attributes of ‘web_global_verification’:

There are two search options available in the ‘Global text find’. You choose either of them as per the type of the search text i.e. Text String or Text Boundary.

a. Search for specific Text: For the specific search text string, you can use this option. Example: User Name, <Company Name> etc. You can further customize your search by using text flags like match case, binary data, use # for any digit, use wild card etc.

b. Search for Text by start and end of string: This option is used when the string is not known in advance but you know what strings will precede and follow it. For example, an application displays a message on every page. The message is “You are logged in with XYZ ID.” where XYZ is a user ID. To confirm this message on every page of the application, you can add the web_global_verification function with the string preceded by ‘You are logged in with ‘ and followed by the text ‘ ID.’.

Hence Start String would have You are logged in with and the End String would have ” ID.”.

You can further customize your search by using text flags like match case, binary data, use # for any digit, use wild card etc.

c. Search in (Search): This is an optional attribute with the default value ‘Noresource’. The scope of the search is to search for the delimited data. The possible values 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
  • Noresource: The scope is only the HTML body, no header or any other resource.

d. Fail if: This is an optional attribute and the default value is “Found”. It has two options; NotFound and Found. You can choose either of the options as per your requirements.

  • 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.

e. ID: The identity of the web_global_verification function. This ID attribute helps to pause or resume the function when multiple web_gloal_verification functions are used in the script.

Note: To suspend the global check, use web_global_verification_pause and to activate the check again, use web_global_verification_resume. If more than one global checks are added in the script then use web_global_verification_pause and web_global_verification_resume for each check which you want to suspend and activate respectively. Use the ID attribute to suspend or resume the specific check function.

Example of web_global_verification
Figure 02: Example of web_global_verification

You may be interested:


Leave a Comment