There are a number of different ways to control error handling within LoadRunner scripts. The most common method is using the Runtime Settings option "General/Miscellaneous", this provides three possible settings as follows:
1. Continue on Error; this setting will allow scripts to carry on unless the connection is dropped with the vuser. This setting is not advised unless you can clearly predict what will happen to your scripts, and especially test data which may become corrupted. By default scripts will exit when an error occurs.
2. Fail open transactions on lr_error_message; This allows use of the lr_error_message function within a script. A tester can set an error condition using this function. If triggered during a transaction, it will flag that transaction as having failed.
3. Generate snapshot on error; this setting allows a snapshot of the application screen when an error occurs.
By default all of the above options are switched off.
The other option to handle script errors is a LoadRunner utility function which can be used within scripts to change the error handling logic for a single step, or group of steps within a script.
lr_continue_on_error (Check the Vugen function reference for further details)
This function allows control over how your script will behave when an error occurs. Note that this overrides the RTS settings above, specifically the "Continue_on_error" setting.
Format of function: lr_continue_on_error(error_continuation_value)
Example: lr_continue_on_error(1);
Possible error continuation values for this functions are as follows:
0
lr_on_error_no_options
This setting is essentially the same as the RTS setting when not checked
1
lr_on_error_continue
This setting is essentially the same as the RTS setting when checked
2
lr_on_error_skip_to_next_action
This setting forces termination of the current action
3
lr_on_error_skip_to_next_iteration
This setting forces termination of the current iteration
4
lr_on_error_end_vuser
This setting forces the current vuser to end

These settings can be switched on and off during a script, allowing the error level to be modifed for particular steps in your application test script, instead of applying the same error handling level to the entire script.
Be aware that once set, an error level will remain until changed by another instance of the lr_continue_on_error function.

3 comments
  1. Anonymous December 6, 2013 at 5:03 AM  

    Thank you!

  2. Anonymous May 19, 2014 at 5:36 AM  

    Usefull information, Thank you!!!!

  3. Unknown July 21, 2017 at 9:55 PM  

    Good info