How to rerun a script all over again in load runner if it fails in one of the steps
Question ID: 108809
0
0

We have a VuGen script created for some transaction in SAP GUI. We have lot of Order IDs which we have parameterized. For any of the Order IDs if the application is unable to render the records, then there will an error at the bottom panel. We are capturing the error and if this exists, then we want the script to rerun from the beginning. Could you please help us in getting a piece of code for the same.

Regards,
Bharath

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on January 23, 2019 3:19 pm
185 views
Answers (1)
0
Private answer

Hello BharathAR,

You could use code like this:

In the following example, ''web_reg_find'' searches for the text string ''ABC''. If the string is not found, the script executes Action A. If the string is found one or more times, it executes Action B.

web_reg_find(''Text=ABC'', ''SaveCount=abc_count'', LAST ); // where ''ABC'' is your error message

web_url(''Step'', ''URL=...'', LAST );

if (atoi(lr_eval_string(''{abc_count}'')) == 0) {
// ACTION A
lr_output_message('' error not found .... And the abc_count is zero''); // Continue running iteration

} else {
// ACTION B
lr_output_message(''Found Error Message is %s'', lr_eval_string(''{abc_count}''));
lr_exit(LR_EXIT_ITERATION_AND_CONTINUE, LR_FAIL); // see note below

}

Note, the LR_EXIT_ITERATION_AND_CONTINUE will stop current iteration, and go to the next iteration.
If called from within a block iteration, only the block iteration will be exited, and not the global iteration.

Marked as spam
Posted by (Questions: 12, Answers: 384)
Answered on February 19, 2019 3:36 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top