The lr_continue_on_error() function does not skip to the end of the iteration in scripts where the Run Logic contains Blocks

If a LoadRunner script has Run Logic specified that contains a sequence of Blocks and if the script uses the lr_continue_on_error() function to specify that if an error occurs that script execution should skip to the next iteration, then if an error occurs while running the script, the actual script behaviour is to skip to the start of the next block in the script in the current iteration.

When using blocks within the Run Logic of a script, how is it possible to ensure that if a particular script step fails, that execution continues at the next iteration?

Solution

The following pseudo-code example shows how to skip to the next iteration when a particular script step fails:

web_reg_find(“Search=Body”,
“SaveCount=WrfCount”,
“Text=<search_text>”,
LAST);

lr_continue_on_error(1);

<script_step_that_may_fail_and_not_return_the_search_text>

lr_continue_on_error(0);

if (strcmp(lr_eval_string(“{WrfCount}”),”0″)==0) {
lr_exit(LR_EXIT_MAIN_ITERATION_AND_CONTINUE,LR_PASS);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s