Forum Discussion

RobinOng's avatar
RobinOng
Occasional Contributor
10 years ago

testRunner.fail() - Stops execution of testcase

Hi all,

 

I have made a small testcase with the following steps:

  • DataSource (contains 2 rows (Excel))
  • GroovyScript (compares values of current row in DataSource)
  • DataSource Loop (Target Step = GroovyScript)

In the TestCase options I have unChecked the option "Abort on Error" and checked the option "Fail TestCase on error".

 

In the GroovyScript I compare 2 values and call the testRunner.fail() when the values don't match.

 

The problem is that when I call testRunner.fail(), the execution of the case stops. So it fails on record 1 and never gets to record 2.

 

Why is this happening since I have explicitly said that I don't want to abort on fail?

 

Thank you in advance.

 

Regards,

Robin

 

 

1 Reply

  • nishantna's avatar
    nishantna
    Occasional Contributor

    testRunner.fail() is not concerned with "Abort the test if an error occurs", as specified in the API documentation it simply "Fails an ongoing test run with the specified reason".When you are using testRunner.fail(), it simply fails the test case and doesn't go to the next test data.