Global Verification in LoadRunner

In this article, we are going to see about global verification in LoadRunner function. Usually we use weg_reg_find function to validate the content in the response. This will ensure whether we are getting proper response or not from the server. Instead of adding web_reg_find function every now and then, it is possible to add global verification in LoadRunner.

What is global verification in LoadRunner?

Global verification in LoadRunner searches for a string in all the requests. Function syntax is

web_global_verification

web_reg_find searches only for a request, but web_global_verification searches for a string in all the requests. E.g. if your script has 10 requests, it searches for a given string in all the requests.

Global Verification in LoadRunner
Globlal Verification in LoadRunner

Scenario

Assume that you are testing google like website in different regions google.com, google.ca, and google.in. In all the three websites following links are present About, Business, and Advertising. In your script, you might have added three web_reg_find(); for each website. So totally, you would have added 9 web_reg_find(); statements as shown below.

web_set_sockets_option("SSL_VERSION", "TLS");

web_reg_find("Text=Advertising", LAST);

web_reg_find("Text=Business", LAST);

web_reg_find("Text=About", LAST);

web_url("www.google.com",

"URL=https://www.google.com/",

"Resource=0",

"RecContentType=text/html",

"Referer=",

"Snapshot=t1.inf",

"Mode=HTML",

LAST);

web_reg_find("Text=Advertising", LAST);

web_reg_find("Text=Business", LAST);

web_reg_find("Text=About", LAST);

web_url("www.google.com",

"URL=https://www.google.in/",

"Resource=0",

"RecContentType=text/html",

"Referer=",

"Snapshot=t1.inf",

"Mode=HTML",

LAST);

web_reg_find("Text=Advertising", LAST);

web_reg_find("Text=Business", LAST);

web_reg_find("Text=About", LAST);

web_url("www.google.com",

"URL=https://www.google.ca/",

"Resource=0",

"RecContentType=text/html",

"Referer=",

"Snapshot=t1.inf",

"Mode=HTML",

LAST);

Here is the output using 9 web_reg_find() function:

Running Vuser...
 Starting iteration 1.
 Starting action Action.
 Action.c(4): web_set_sockets_option started          [MsgId: MMSG-26355]
 Action.c(4): web_set_sockets_option was successful          [MsgId: MMSG-26392]
 Action.c(7): web_reg_find started          [MsgId: MMSG-26355]
 Action.c(7): Registering web_reg_find was successful          [MsgId: MMSG-26390]
 Action.c(8): web_reg_find started          [MsgId: MMSG-26355]
 Action.c(8): Registering web_reg_find was successful          [MsgId: MMSG-26390]
 Action.c(9): web_reg_find started          [MsgId: MMSG-26355]
 Action.c(9): Registering web_reg_find was successful          [MsgId: MMSG-26390]
 Action.c(11): web_url("www.google.com") started          [MsgId: MMSG-26355]
 Action.c(11): Registered web_reg_find successful for "Text=Advertising" (count=1)          [MsgId: MMSG-26364]
 Action.c(11): Registered web_reg_find successful for "Text=Business" (count=1)          [MsgId: MMSG-26364]
 Action.c(11): Registered web_reg_find successful for "Text=About" (count=1)          [MsgId: MMSG-26364]
 Action.c(11): web_url("www.google.com") was successful, 64367 body bytes, 715 header bytes, 723 chunking overhead bytes          [MsgId: MMSG-26385]
 Action.c(20): web_reg_find started          [MsgId: MMSG-26355]
 Action.c(20): Registering web_reg_find was successful          [MsgId: MMSG-26390]
 Action.c(21): web_reg_find started          [MsgId: MMSG-26355]
 Action.c(21): Registering web_reg_find was successful          [MsgId: MMSG-26390]
 Action.c(22): web_reg_find started          [MsgId: MMSG-26355]
 Action.c(22): Registering web_reg_find was successful          [MsgId: MMSG-26390]
 Action.c(24): web_url("www.google.com") started          [MsgId: MMSG-26355]
 Action.c(24): Redirecting "https://www.google.in/" (redirection depth is 0)          [MsgId: MMSG-26694]
 Action.c(24): To location "https://www.google.co.in/"          [MsgId: MMSG-26693]
 Action.c(24): Registered web_reg_find successful for "Text=Advertising" (count=1)          [MsgId: MMSG-26364]
 Action.c(24): Registered web_reg_find successful for "Text=Business" (count=1)          [MsgId: MMSG-26364]
 Action.c(24): Registered web_reg_find successful for "Text=About" (count=1)          [MsgId: MMSG-26364]
 Action.c(24): web_url("www.google.com") was successful, 64392 body bytes, 1044 header bytes, 471 chunking overhead bytes          [MsgId: MMSG-26385]
 Action.c(33): web_reg_find started          [MsgId: MMSG-26355]
 Action.c(33): Registering web_reg_find was successful          [MsgId: MMSG-26390]
 Action.c(34): web_reg_find started          [MsgId: MMSG-26355]
 Action.c(34): Registering web_reg_find was successful          [MsgId: MMSG-26390]
 Action.c(35): web_reg_find started          [MsgId: MMSG-26355]
 Action.c(35): Registering web_reg_find was successful          [MsgId: MMSG-26390]
 Action.c(37): web_url("www.google.com") started          [MsgId: MMSG-26355]
 Action.c(37): Registered web_reg_find successful for "Text=Advertising" (count=1)          [MsgId: MMSG-26364]
 Action.c(37): Registered web_reg_find successful for "Text=Business" (count=1)          [MsgId: MMSG-26364]
 Action.c(37): Registered web_reg_find successful for "Text=About" (count=1)          [MsgId: MMSG-26364]
 Action.c(37): web_url("www.google.com") was successful, 63839 body bytes, 696 header bytes, 426 chunking overhead bytes          [MsgId: MMSG-26385]
 Ending action Action.
 Ending iteration 1.
 Ending Vuser...

Instead of adding 9 web_reg_find(); snippet, you can add only three web_global_verfication(); in the vuser_init() action as shown below.

vuser_init()
 {
 web_global_verification("Text=Advertising",
 "Fail=NotFound",
 "ID=Find Advertising",
 LAST);

web_global_verification("Text=Business",
 "Fail=NotFound",
 "ID=Find Business",
 LAST);

web_global_verification("Text=About",
 "Fail=NotFound",
 "ID=Find About",
 LAST);

return 0;
 }

Here is the output.

vuser_init.c(5): web_global_verification started      [MsgId: MMSG-26355]
 vuser_init.c(5): Registering web_global_verification was successful      [MsgId: MMSG-26390]
 vuser_init.c(10): web_global_verification started      [MsgId: MMSG-26355]
 vuser_init.c(10): Registering web_global_verification was successful      [MsgId: MMSG-26390]
 vuser_init.c(15): web_global_verification started      [MsgId: MMSG-26355]
 vuser_init.c(15): Registering web_global_verification was successful      [MsgId: MMSG-26390]
 Ending action vuser_init.
 Running Vuser...
 Starting iteration 1.
 Starting action Action.
 Action.c(4): web_set_sockets_option started      [MsgId: MMSG-26355]
 Action.c(4): web_set_sockets_option was successful      [MsgId: MMSG-26392]
 Action.c(8): web_url("www.google.com") started      [MsgId: MMSG-26355]
 Action.c(8): web_url("www.google.com") was successful, 64457 body bytes, 713 header bytes, 796 chunking overhead bytes      [MsgId: MMSG-26385]
 Action.c(19): web_url("www.google.com") started      [MsgId: MMSG-26355]
 Action.c(19): Redirecting "https://www.google.in/" (redirection depth is 0)      [MsgId: MMSG-26694]
 Action.c(19): To location "https://www.google.co.in/"      [MsgId: MMSG-26693]
 Action.c(19): web_url("www.google.com") was successful, 64336 body bytes, 1044 header bytes, 860 chunking overhead bytes      [MsgId: MMSG-26385]
 Action.c(30): web_url("www.google.com") started      [MsgId: MMSG-26355]
 Action.c(30): web_url("www.google.com") was successful, 63798 body bytes, 696 header bytes, 920 chunking overhead bytes      [MsgId: MMSG-26385]
 Ending action Action.
 Ending iteration 1.
 Ending Vuser...

If any global verification fails during the execution, you will get a error message as shown below.

Error -26366: “Text=Advertizing” not found for web_global_verification (“Find Advertising”)      [MsgId: MERR-26366]

Advantages of Global verification in LoadRunner

Adding global verification in LoadRunner saves the number of lines in the code which in turns saves the time to compile and execute. But on the other side, it will check for the text for all the requests in the script. In next blog, we will see how to pause and resume the global verification in LoadRunner.

About the Author

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Hamster - Launch JMeter Recent Test Plans SwiftlyDownload for free
+
Share via
Copy link