Error handling
You can specify how a Vuser handles errors during script execution. By default, when a Vuser detects an error, the Vuser stops executing the script. You can instruct a Vuser to continue with the next iteration when an error occurs using one of the following methods:
-
Using runtime settings. You can specify the Continue on Error runtime setting. The Continue on Error runtime setting applies to the entire Vuser script. You can use the lr_continue_on_error function to override the Continue on Error runtime setting for a portion of a script.
-
Using the lr_continue_on_error function. The lr_continue_on_error function enables you to control error handling for a specific segment of a Vuser script. To mark the segment, enclose it with
lr_continue_on_error(1)
; andlr_continue_on_error(0);
statements. The new error settings apply to the enclosed Vuser script segment. See the paragraphs below for details.
For example, if you enable the Continue on Error runtime setting and a Vuser encounters an error during replay of the following script segment, the Vuser continues executing the script:
web_link("EBOOKS", "Text=EBOOKS", "Snapshot=t2.inf", LAST); web_link("Find Rocket eBooks", "Text=Find Rocket eBooks", "Snapshot=t3.inf", LAST);
To instruct the Vuser to continue on error for a specific segment of the script, enclose the segment with the appropriate lr_continue_on_error statements:
lr_continue_on_error(1); web_link("EBOOKS", "Text=EBOOKS", "Snapshot=t2.inf", LAST); web_link("Find Rocket eBooks", "Text=Find Rocket eBooks", "Snapshot=t3.inf", LAST); lr_continue_on_error(0);