views:

163

answers:

1

I have a number of test cases using groovy.

I want to be able to have the test case fail but to carry on with the rest of the script. Tried using:

testRunner.fail( "It didn't work" )

also tried

assert false : "It didn't work"

but they both abort the test case even if the abort on error is unchecked.

Any ideas?

A: 

The usual way to fail a test case is to call the fail() method of Junit, rather than using assert or testRunner.fail(). However, I'm not sure whether tests subsequent to a failed test will be executed.

This fail method is either a static method of Assert or an instance method of TestCase depending on whether you're using JUnit 4 or 3.8.

Don