gradle / test-retry-gradle-plugin

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

Test results are published after every re-run. #167

Closed tyz51 closed 1 year ago

tyz51 commented 1 year ago

I have got additional functionality to publish test results from custom listener. Now I see that results are published every re-run. Since this is 'test' task rerun - new instance of listener is created. My question is ---> how can I handle the case if I want to publish report only after all retry happned?

marcphilipp commented 1 year ago

You could do it from a finalizer task (which are executed regardless whether the test task failed), e.g. something like this:

val reportTestResults by tasks.registering {
    // ...
}

tasks.test {
    finalizedBy(reportTestResults)
}
tyz51 commented 1 year ago

Thanks @marcphilipp! I'll try and let you know!