6

Is there a way to make running junit test to stop after a test fails?

Bloodboiler
  • 2,082
  • 2
  • 24
  • 21

2 Answers2

5

I know that in Ant, the junit task has options "haltonerror" and "haltonfailure" that controls this behavior.

Dave Costa
  • 47,262
  • 8
  • 56
  • 72
3

Yes ... this ability (or the lack of it) is built into the various TestRunners (Console, AWT, Swing, Ant, Maven or the one built into Eclipse, etc). You'll have to look for this control in the documentation for the specific platform you're using.

Steve Moyer
  • 5,663
  • 1
  • 24
  • 34
  • maven-surefire-plugin now supports a neat option, [skip after failure](http://maven.apache.org/surefire/maven-surefire-plugin/examples/skip-after-failure.html) – buer Aug 04 '17 at 11:49
  • Here is a POM example for maven's skipAfterFailure: org.apache.maven.plugins maven-surefire-plugin 3.0.0-M4 1 – JohnP2 Feb 13 '20 at 19:06