org.gradle.test-report-aggregation restricts on testType #24272
Labels
a:feature
A new functionality
has:reproducer
Indicates the issue has a confirmed reproducer
has:workaround
Indicates that the issue has a workaround
in:java-plugins
java-library, java, java-base, java-platform, java-test-fixtures
in:reporting-tasks
help dependencyInsight dependencies
in:test-suites
Work related to the JvmTestSuite Plugin
Gradle 7.6, not sure if this all changed in Gradle 8.0. I can't update yet.
Note: some trivial setup (task group, dependsOn, etc.) is omitted from brevity. The real solution is about ~100 lines.
Context
Here's a use case: I have some production code that works on Java XML/XSLT. There are several implementations for XSLT, and I would like to test them all. The test code is exactly the same for each, so all I need to "parameterize" is the classpath. For this I came up with this combo:
testing.suites
to create integration test tasks, sourceSets and segregate dependencies.java.registerFeature
to create a shared folder for the common tests.testTask
created in 1. .This all works pretty well, my eyes were watering the Gradle DSL design is so beautiful and everything just clicked into place and worked the first time, but then it all turned around when I tried to merge the test reports from the suites. The whole of the
org.gradle.jvm-test-suite
andorg.gradle.test-report-aggregation
is built around the assumption that it aggregates the SAME type of tests from different places, but it's not able to merge DIFFERENT test types.Current Behavior
I want to merge all the suites' results, but they're forcefully separated into
testType.set("${TestSuiteType.INTEGRATION_TEST}-${name}")
.I literally did a triple-take while reading this sentence, I couldn't believe it:
I cannot set
testType.set(TestSuiteType.INTEGRATION_TEST)
for all of the suites (which would be the truth), because of the above limitation. And this is where it all breaks when actually trying to use thetestType
:Expected Behavior (a potential solution)
This is just a guess on how this could be resolved, ideally the whole limitation on uniqueness would be lifted (this is why it's incubating, right?).
I spent hours trying to debug and figure out how to do the above, trying hack this line out of
TestReportAggregationPlugin
:I managed to do it (with 1 reflective call), but no luck. I might be missing more steps though.
Workaround
After the hours of trying, I gave up and threw away
id(test-report-aggregation)
and did it the old way by copying the parts I needed from the plugin:This feels like I'm hacking, but it works.
Final thoughts
I think this limitation should be fixed in some way for the feature to become stable. The above is just one use case for this. There's another trivial one: I want to create an uber-report from all unit/functional/integration/etc. test suites from all modules. Just one
index.html
for EVERYTHING. Based on what I've observed here, this is simply not possible today without rewriting the aggregation plugin from scratch.The text was updated successfully, but these errors were encountered: