How to inject properties into JUnit XML output file with Test task?

If I run a Spock test from Ant, all the ant property values are injected into the testsuite/properties element in the Junit XML output. If I run it from Gradle, testsuite/properties is empty. How can I cause properties to be emitted in the XML? I’m happy to set those properties myself (understanding that there will not be any ant properties since ant’s not being used). Tried adding a systemProperty but that didn’t show up.

Using gradle 1.0-rc-3 with groovy 1.8.6 and spock 0.6.

There’s currently no way to do this.

What’s your use case for wanting to populate the properties?

Trying to switch from Ant to Gradle as part of a larger tool chain that expects to find information in properties. Could do it via XSLT post-processing, but that seems clumsy vs. sticking with pure Groovy. Given the properties element is present, just empty, it doesn’t seem too wildly off in the weeds to want to put things there, similarly to the way Ant does.

What properties do you need though? How are they being used by downstream tooling? I’d like to understand why it’s needed.

Downstream tool uploads the JUnit XML file into a QA reporting database. Expects to find ant.project.name in the properties section so it can associate the results with the correct project. I am a Gradle early adopter in my org, surrounded by Ant. Good news is people who are seeing my Gradle usage are liking it. In general the notion of some level of “Ant compatibility” in this area seems sensible to me. Things like JVM and JUnit configuration values in the properties section could be useful.

As a workaround, I created a simple method that uses replaceAll to inject a property element for ant.project.name into the properties element for each testsuite in the consolidated JUnit report. I call it during afterSuite.