2

I have a bunch of JUnit tests I'm running with maven using the following plugin:

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>

When I run them, they take about 20 minutes to run. Sometimes a test 2 minutes in will fail, but the whole thing will keep running.

I'd like to kill it as soon as I know a test has failed.

My question is: How to show a 'running total' of test successes and failures in maven?

Razib
  • 10,965
  • 11
  • 53
  • 80
hawkeye
  • 34,745
  • 30
  • 150
  • 304
  • First how many tests are you running? Are you running from Eclipse/IntelliJ or from Console? – khmarbaise Apr 01 '15 at 12:17
  • Caution: There is a bug in surefire that causes that if you interrupt maven process, surefire test runner is still running as a separate process. – Antoniossss Apr 01 '15 at 12:57
  • Possible duplicate: http://stackoverflow.com/questions/1923857/is-there-a-way-to-fail-fast-for-junit-with-the-maven-surefire-plugin – Antoniossss Apr 01 '15 at 13:00
  • Are you aware of [`RunListener`](http://junit.sourceforge.net/javadoc/org/junit/runner/notification/RunListener.html)s? You can write a class that will listen and do some logic at the beginning and end of each test; you could use that to log the current test count for example. Also, see [this question](http://stackoverflow.com/questions/4968475/using-junit-runlistener-with-maven) – Tunaki Apr 01 '15 at 14:02

0 Answers0