How to make Openscript skip current child script failure and continue execution

Like Tweet Pin it Share Share Email

Assuming that you are aware of test data parameterization in OpenScript using databank, in case you are not aware, request you to go through the following article

Openscript test data parmeterization with databanks

Now when we execute scripts for multiple iterations, it is highly possible that one of the test data iteration might fail / one of the child script might fail when there were bunch of child scripts called from a parent script.

Depending on the situation, some wants the entire execution to stop and report the error, but in most scenarios, you wish to skip the failed iteration / child script and continue the execution with next iteration or next child script.

Now lets see how we can make OpenScript skip the failure of current iteration or current child script and continue with next iteration / next child script.

There is an error recovery setting in OpenScript, which will help you to skip the current iteration and then move to next.

Steps to perform are as below:

  1. Navigate to View > OpenScript Preferences
  2. Under Playback > Error Recovery
  3. On the right of the window you see a section by name General , which has a setting for “Child Script Failed” , Select option “Report Error and Continue”
  4. Click Apply, Ok buttons and close the window.

Now when you execute the parameterized script with Iterate Playback, even if the script fails for 1 iteration, it would continue from next iteration till the end of all iterations.

I hope this will help you. In case of any queries, please do revert to us in form of comments, we would try our best to help you out.

Comments (4)

  • Hi ,

    Here, we are setting Report Error and Continue in tool level(in Error Recovery Widget).
    It is better to keep in the script level(Parent/master script). If we keep at tool level, every time we have check where setting is there or not.

    We can add below code/statement in the parent/master script.

    setErrorRecovery(BasicErrorRecovery.ERR_CHILD_SCRIPT_EXCEPTION, ErrorRecoveryAction.ReportErrorAndContinue);

    Thanks & Regards,
    Ramesh Jadala

  • Hi Srinivas,

    Is there any way to stop the script execution as soon as a failure is encountered?
    Will it hold good for OTM aswell?


    • Author

      Hi Aisha,

      As discussed with you, if you are using master driver script, one of the options is to have a global variable declared as false and in every child script @ initialize method set it to false and in the finish method set it to true.
      So in the master driver when you try to call each child script check if the global variable is true or not, otherwise you can skip execution of the script.

      Hope it helps, there can be other ways too.

      Thank You,
      Srinivas P.


Leave a Reply

Your email address will not be published. Required fields are marked *