Forum Discussion

vpachpute1's avatar
vpachpute1
Frequent Contributor
8 years ago

Execution is aborted if any Groovy step is failed in between

Hi   I have groovy scripts i between Test Steps.   But if any Groovy script fails, further execution is stopped.   Note: In Options: I have unchecked Abort Test if an error occurs. PFA of same ...
  • HKosova's avatar
    HKosova
    8 years ago

    Hi Vishal,

     

    Unchecking the "Abort test if an error occurs" option should be enough.

     

    How does your first Groovy script set the failed status? The proper way to fail a script is to use an assert or throw an exception, e.g.:

    assert somevalue == "expected value"
    
    // or
    if (somevalue != "expected value") {
      throw new Exception("Result is not as expected!")
    }

    But if your Groovy script uses testRunner.fail:

    testRunner.fail("Result is not as expected!")

    then this line stops the entire test. The "Abort test if an error occurs" option is ignored in this case.