Is there a way to make running junit test to stop after a test fails?
Asked
Active
Viewed 5,189 times
6
-
2I don't know the answer, but I've been thinking about it for a while. The thing that keeps coming to my mind is: Why do you want that? – Benno Richters Oct 09 '08 at 19:28
-
1Exactly: why not see all failing tests? – marcospereira Oct 10 '08 at 01:47
2 Answers
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