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);

  • 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

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