Highlighted
Absent Member.
Absent Member.
3519 views

Please help me out in understanding error handling technique using web_reg_find

What is the difference between the below two error handling techniques, which one can be opted for day to day scripting usage.
The main issue which I see while using "lrexit (second type)" error handling is in vugen for e.g. if I run 3 iterations for a script which should fail, in test results only the first iteration shows as failed the rest two iteration gets displayed as passed even though they get exited out of the code.

Please explain the better method to use and how to make sure the script doesn't proceed further when a text check fails.

Error handling technique 1:
********************************
web_reg_find("text=xxx", "savecount=xxxx", "fail=notfound")

AND


Error handling technique 2:
********************************
web_reg_find("text=xxx", "savecount=abccount")

if(atoi(lr_eval_string("{abcount}"))==0)
{
lr_error_message("the page failed to load");
lr_end_trnsaction("abcd",LR_FAIL);
lr_exit("lr_exit_iteration_and_continue",LR_FAIL);
}
lr_end_transaction("abcd",LR_AUTO);

0 Likes
2 Replies
Highlighted
Honored Contributor.
Honored Contributor.

Re: Please help me out in understanding error handling technique using web_reg_find

Hi

Error handling technique 1 will check the text whether iit is available in the page or not.But it will continue to run if "Continue on Error" option in RunTime settings is checked or else it will stop and shows the error message if "Continue on Error" unchecked

Whereas Error handling technique 2 will stop the iteration if the text is not identified and moves to the next iteration.

 

Option 2 is preferable as it will stop the unwanted hits  count to the server

 

Regards,

Raghul M

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Please help me out in understanding error handling technique using web_reg_find

Hi, are you sure you see the result you describe for the second version?

I use the second technique almost exclusivly when running the Web HTTP/HTML protocol and I see failed iterations being reported as failed in the reports.

 

Are you able to reproduce the behaviour using a minimal Vugen script? You don't need to use web_reg_* calls, just the lr_exit() call, in a minimal script.

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.