gradle / test-retry-gradle-plugin

Gradle plugin to retry tests that have failed to mitigate test flakiness.
Apache License 2.0
220 stars 49 forks source link

Execution failed for task ':test'. > The following test methods could not be retried, which is unexpected. Please file a bug report at https://github.com/gradle/test-retry-gradle-plugin/issues #208

Closed VladyslavOcheret closed 4 months ago

VladyslavOcheret commented 1 year ago

gradle = 6.8 org.gradle.test-retry 1.5.4

I got an issue with retry-test plugin, when my test failed on class method, and even if it was success after retry I see in logs Execution failed for task ':test'. > The following test methods could not be retried, which is unexpected. Please file a bug report at https://github.com/gradle/test-retry-gradle-plugin/issues com.iwelcome.test.login.TwoFaEmailNoPreferredLanguageTests#classMethod com.iwelcome.test.credential.omi.OmiEndpointAndScopeTests#classMethod com.iwelcome.test.oauth2.ResourceOwnerPasswordCredentialFlowTests#classMethod how I can disable it after retry? build.gradle

test {
    reports.junitXml.mergeReruns = true
    retry {
        maxRetries = 3
        maxFailures = 20
        failOnPassedAfterRetry = false
    }
    testLogging {
        events "failed"
        exceptionFormat "full"
    }
    filter {}

    // Fail the 'test' task on the first test failure
    failFast = false

    // set heap size for the test JVM(s)
    minHeapSize = "128m"
    maxHeapSize = "512m"

    afterTest { desc, result ->
        def totalTime = result.endTime - result.startTime

        println "${result.resultType} -- [${desc.className}].${desc.name} -- runtime: ${totalTime}ms"

    }

in report all okay and it's replaced from failure to flakyFailure but this error make build red or maybe somebody knows how to throw full test name to retry plugin?

VladyslavOcheret commented 1 year ago

@ldaley I see what it must be resolved in https://github.com/gradle/test-retry-gradle-plugin/commit/20869f1caa84dd5008c02ff755816f4c2e4219cb but for me it's still present in CI, if I run locally I don't see this error

marcphilipp commented 12 months ago

@VladyslavOcheret Could you please share more details on what test frameworks etc. the test classes in question are using?

VladyslavOcheret commented 12 months ago

@marcphilipp sure, we use Junit 4, and test are using, so problem was in what test was restarted and even if he will green we have exception which I mentioned, downgrade to version 1.1 of retry-plugin resolve this issue but I want also to use new version

marcphilipp commented 12 months ago

Which version of JUnit 4 are you using?

VladyslavOcheret commented 12 months ago

JUnit 4.12

pshevche commented 5 months ago

@VladyslavOcheret , if the issue still persists, could you please provide a small reproducer? We are particularly interested in the test side.

pshevche commented 4 months ago

I am not able to reproduce the issue with the following setup:

With this setup, retries succeed.

I'll close the issue for now. @VladyslavOcheret , feel free to re-open if the issue persists and you have a reproducer you could share with us.