"Group of steps" that should be executed if script fails at any point?

  • Hello,

    is it possible to define e.g. a function with some steps that will be executed after a script/thread fails at any point of the script (e.g. button on page not found, url does not load...).

    I know such a feature from another automation framework where you can define a "Good End" and "Bad End". The "Bad End" launches steps that will be executed every time when there is some error in the script and only on error. "Good End" for "final steps" after all went well.

    Need at least a solution for "Bad End" :)

    Thank you!

  • You can achieve it with "Ignore errors" action.
    Just encapsulate your whole script code in one
    "Ignore errors" function and define your steps
    in "On error" part of function, which will be executed
    in case of any error. Below (under) that you can define
    steps for "Good End"scenario, because "ignore errors"
    action just logs error text (by default - you can change it)
    and continues script execution.

    Furthermore you can use "Ignore errors" just on actions
    that are likely to produce an error and define what happens
    if error happens. Just bare in mind that script continues
    execution if you use "Ignore errors", and it can be applied
    to any action (cube) in script. There is a button on every cube
    that automatically encapsulate given cube in "Ignore errors"

  • @GaG Thank you very much for your appreciated help :)

    Is there no problem with encapsulating the whole script in "Ignore Errors" when I already have wrapped a couple of steps (blocks) inside the script in "Ignore Errors" block?

  • Not sure what will happen in that case. You can experiment and see what
    happens in such case, and what function will execute in such case.

    On the other hand, if you already use ignore errors on several points
    in the script, Im sure you can write such program logic and decide based
    on error type reported what happens after each ignore error function.

    For example you can write separate functions that executes by calling them
    from ignore error functions. Those separate functions can, for example,
    handle error cases when you want script to stop execution, so at the end
    of function you can explicitely use actions that finishes the script with success
    or with fail message. And in such scenario you dont need to encapsulate whole
    script, but rather controll it with your custom logic on each place you use
    ignore errors function.

    So you can for ex. retry to load page 2-3 times based on ignore errors function
    used in a loop, and if error persist after 2-3 cycles, you can call your special function
    that will terminate script execution after such condition is met.

Log in to reply