Junit testResultsDir 3.3 vs 4.10.1 builds


(Paul S) #1

Firstly, let me admit to being a gradle neophyte. As with I suspect most users, I have to relearn gradle periodically when I need to make modifications to our working build scripts. In my current situation, I’m trying to upgrade to the latest version of gradle, version 4.10.1. We had previously been using 3.3. Builds are failing on our Jenkins server, because the build job is configured to look for the JUnit XML reports in **/build/test-results/.xml. After upgrading to 4.10.1, the XML files are going into **/build/test-results/test/.xml, and I cannot figure out why. In looking at the documentation on the Java plug-in, https://docs.gradle.org/current/userguide/java_plugin.html, I see that testResultsDir should default to buildDir / testResultsDirName which should expand to build/test-results. Given that I have changed just the one line in our top level build.gradle file from gradle 3.3 to 4.10.1, I’m not sure whether this documentation is wrong, there is a bug in 4.10.1, or somehow I’m overriding the defaults in a way that works differently from 3.3 to 4.10.1. If anyone can offer any guidance on whether this is a known issue or an expected change to the defaults that doesn’t appear to be documented, I would greatly appreciate it. Obviously, I can easily change our Jenkin’s job’s configuration, but I would prefer to figure out why upgrading seems to have changed the output location.


(Stefan Wolf) #2

Hi Paul,

I think the change to add the name of the test task for the test result directory was in 3.0: https://docs.gradle.org/3.0/release-notes.html#unique-default-test-result-and-report-directories-for-test-tasks

Maybe you have been using the workaround described there to re-map the test output directory to its old place and that stopped working?

Regarding the documentation: The documentation in the Java Plugin chapter seems to be wrong now. Can you please open an issue for this on gradle/gradle?

Cheers,
Stefan