gradle-test-logger-plugin
gradle-test-logger-plugin copied to clipboard
Test output is shown twice for every test
Description
Every test is displayed twice in the gradle output but in different styles.
Versions
- Test logger version: 3.1.0
- Gradle version: 7.3.2
- Java version: 16
Type of test being run
Junit5 tests
Test logger configuration
testlogger {
theme = ThemeType.MOCHA_PARALLEL
showSimpleNames = true
slowThreshold = 1000
}
Screenshots
I think one set of outputs is from Gradle. Do you have Gradle's testLogging
configured as well?
No, not knowingly. Here is the build file of one of the projects where I am using your test logger: https://github.com/skrapeit/skrape.it/blob/master/build.gradle.kts
It started logging all tests twice after I bumped the dependencies including this testlogger as well as the gradle version
Can you try setting this in your build script and let me know if that fixes things?
test {
testLogging {
+ showStandardStreams = false
}
}
Up until 3.0.0, I used to reset any logging events set on the testLogging closure but doing so seems to be discouraged in Gradle 7. So I've removed the resetting logic. I am wondering if that has caused the issue you're seeing.
Setting the showStandardStreams
option to false
unfortunately didn't change the result.
Here is the commit deactivating the Standard streams with corresponding log output (hope you can see it) https://github.com/skrapeit/skrape.it/runs/4850664855?check_suite_focus=true
Thanks, that was useful. Can I ask you to try setting this as well please?
test {
testLogging {
+ lifecycle.events = []
}
}
If this setting manages to hide the undesirable output, I will have to think of another way to revert the functionality which was previously present.
this will throw an exception (i am using gradle kotlin dsl)
i turns out that configuring testLogging events as part of the test task e.g.
test {
testLogging {
events(TestLogEvent.PASSED, TestLogEvent. SKIPPED, TestLogEvent.FAILED)
}
}
will lead to the described behavior. everything is working as expected when the events are removed. Not sure if thats intended or a bug.