Alexey Subach created SUREFIRE-1470:

             Summary: Unexpected report result when using 
rerunFailingTestsCount with groups filter in Surefire
                 Key: SUREFIRE-1470
             Project: Maven Surefire
          Issue Type: Bug
          Components: Maven Surefire Plugin
            Reporter: Alexey Subach

When the following plugin configuration is used:

And there is a test that fails first time it's run, the resultant *txt* report 
is unexpected and only contains the result of last rerun.

Suppose we have the following test class:

public class CustomTest {

    public void alwaysPassingTest() {
        Assert.assertEquals(0, 0);

    private static volatile int x = 0;

    public synchronized void secondAttemptPassingTest() throws 
InterruptedException {
        if (x++ == 0) {


The resultant xml report is all right, but the txt one is

Test set: CustomTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.063 s - in 

Which is basically incorrect. The *txt* file is regenerated several times 
during the test run.

The issue is present when groups filter (either exclusion or inclusion) is 
present. When there is no group filter and only rerunFailingTestsCount is 
configured, then the resultant report is the following one:

Test set: CustomTest
Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.065 s <<< 
FAILURE! - in CustomTest
secondAttemptPassingTest(CustomTest)  Time elapsed: 0.009 s  <<< FAILURE!
        at CustomTest.secondAttemptPassingTest(

When no group filter is configured, Junit4Provider instead of JunitCore 
provider is picked up and they seem to handle those cases differently.

The situation is worsened by the fact that TeamCity is not able to parse the 
results correctly when the groups are configured along with 
rerunFailingTestsCount and it marks the tests that passed after rerun as 
failed, although the overall Maven result is SUCCESS in both cases.

This message was sent by Atlassian JIRA

Reply via email to