maven-surefire-plugin rerunFailingTestsCount not running tests immediately

26 Views Asked by At

I have the following configuration for maven-failsafe-plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>3.2.5</version>
    <configuration>
        <runOrder>failedfirst</runOrder>
        <rerunFailingTestsCount>2</rerunFailingTestsCount>
        <!-- .. additional configuration removed -->
    </configuration>
 </plugin>  

Ideally I would like the failing tests to run immediately upon failing, but this is not what I am observing. I see something like this happening:

  • GoodTestOne passes
  • BadTestTwo fails
  • GoodTestThree passes
  • GoodTestFour passes
  • BadTestTwo fails
  • BadTestTwo fails

Is this expected behavior? Is there a way to configure failsafe to do this:

  • GoodTestOne passes
  • BadTestTwo fails
  • BadTestTwo fails
  • BadTestTwo fails
  • ...

I am building a TestExecutionListener to abort all tests after a single test has failed the configured allowed number of times, but given that it's running through our entire test suite (which takes almost 20 minutes) before re-running failed tests, it defeats the purpose.

I realize that "skipAfterFailureCount" provides this functionality, but we are using JUnit 5 and this is not yet supported.

0

There are 0 best solutions below