There are a number of external tools that produce ...
# plugin-development
y
There are a number of external tools that produce results in JUnit XML and which can be called from Gradle. One example being
terraform test -junit-xml
. What I would like to do is to convert those XML files into HTML reports that look-and-feel the same as the ones generated by
Test
tasks. Does anyone know whether that can be achieved with what we have available in the Gradle API today (7.3+)?
m
the somewhat new Test Reporting API can do that - https://docs.gradle.org/current/userguide/test_reporting_api.html
it has a few rough edges (the weirdest one being that failures need an in-JVM exception type) but overall it works
y
Thanks. I'll have a look
m
correction about failures: it does not need an in-JVM exception type, but it will always wrap it with a
new Throwable()
constructed at the report time, which will be confusing
other than that it should be exactly what you're looking for though 🙂 it will generate the HTML reports with the same renderer that the
Test
tasks use and it will also report the test results to Develocity / build scans (if configured)
s
This means one has to parse the JUnit XML report manually and call the reporting API for each test result, right?
m
correct
s
Has somebody maybe implemented such a parser already?
Including the reporting API calls, I mean
YMMV though, we've only briefly tested this and all of this is pretty alpha right now
v
A not-incubating way would be to have a JUnit engine that parses the file and reports through JUnit platform.