Export JUnit XML that Jenkins can understand. We've been using this for about 18 months in our internal Jenkins. It's not a perfect mapping, but hopefully it's adequate for other people to build on.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Hi,
This would be very useful to us. I tried this patch and it basically works with our CI server too.
I would suggest a couple of minor changes to improve the output format, see inline comments. FWIW the change looks good to me.
Regards
Russ
utils/lit/lit/Test.py | ||
---|---|---|
200 | Omitting the test name from the class name seems like a good idea to me. It allows a junit consumer to group tests by folder. (This is rather a moot point as our tests are files and folders rather than classes and packages). - xml = "<testcase classname='" + ".".join(self.path_in_suite) + xml = "<testcase classname='" + ".".join(self.path_in_suite[:-1]) | |
200–201 | Formatting. def getJUnitXML(self): - xml = "<testcase classname='" + ".".join(self.path_in_suite[:-1]) - xml += "' name='" + '/'.join(self.path_in_suite) + "'" + xml = "<testcase classname='" + ".".join(self.path_in_suite[:-1]) + "'" + xml += " name='" + '/'.join(self.path_in_suite) + "'" if self.result.code.isFailure: | |
201–202 | Add elapsed time. xml += " name='" + '/'.join(self.path_in_suite) + "'" + xml += " time='%.2f'" % (self.result.elapsed,) if self.result.code.isFailure: | |
utils/lit/lit/main.py | ||
446 | Some consumers use the errors attribute to determine the number of passes (tests - failures - errors). xmlFile.write(" tests='" + str(s['passes'] + s['failures']) + "'") + xmlFile.write(" errors='0'") xmlFile.write(" failures='" + str(s['failures']) + "'>\n") |
Omitting the test name from the class name seems like a good idea to me. It allows a junit consumer to group tests by folder. (This is rather a moot point as our tests are files and folders rather than classes and packages).