New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test.afterTest is not called with Configuration Cache #25311
Comments
Further testing... If we add: test.addTestListener(new MyListener())
class MyListener implements TestListener {
void beforeSuite(TestDescriptor suite) {
println("beforeSuite: ${suite}")
}
void afterSuite(TestDescriptor suite, TestResult result) {
println("afterSuite: ${suite} > ${result}")
}
void beforeTest(TestDescriptor testDescriptor) {
println("beforeTest: ${testDescriptor}")
}
void afterTest(TestDescriptor testDescriptor, TestResult result) {
println("afterTest: ${testDescriptor} > ${result}")
}
} it outputs this new listener but not the original one:
If we add test.addTestListener(new TestListener() {
void beforeSuite(TestDescriptor suite) {
println("beforeSuite: ${suite}")
}
void afterSuite(TestDescriptor suite, TestResult result) {
println("afterSuite: ${suite} > ${result}")
}
void beforeTest(TestDescriptor testDescriptor) {
println("beforeTest: ${testDescriptor}")
}
void afterTest(TestDescriptor testDescriptor, TestResult result) {
println("afterTest: ${testDescriptor} > ${result}")
}
}) then we get expected output, but along with a configuration cache failure:
This is why I think this is rooted in CC. |
Related to #24613 |
@TWiStErRob Could you please confirm whether you still see this behavior with tonight's nightly? (builds at midnight) |
@TWiStErRob This time I think we fixed this, when addressing #24613 and friends. Could you please try with a recent 8.4 build? I saw this working fine after I ran:
|
Based on my repro in OP, it is indeed fixed in the quoted version of yesterday's nightly. |
Do you know what fixed it? because the linked #24613's fix only seems to modify TestNG related files. |
I believe the TestNG references are mostly because we didn't have integration test coverage for registering listeners via |
But actually answering your question, I believe the fix was related to simplifying how the |
Thank you! |
which were not working before 8.4. Issue: #25311
Fixed by #25983. |
Expected Behavior
Current Behavior
Context (optional)
When I run the same thing without configuration cache:
Originally I had
logger.quiet(...)
instead ofprintln()
, changed it only to make sure there's no captured Project / Task object in play.Steps to Reproduce
gradlew test --rerun-tasks
(I ran it twice to ensure it always executes)gradlew test --rerun-tasks --configuration-cache
(Note
--rerun-tasks
is not necessary for the repro if you delete thebuild
and.gradle
folders between executions.)Gradle version
repro 8.2-rc-1, tried also 8.0.2
Build scan URL (optional)
No response
Your Environment (optional)
I reproduced this on Windows 10 / Java 17. Discovered it inside a Gradle Test Kit test initially, then separated out a minimal repro.
The text was updated successfully, but these errors were encountered: