The problem with undocumented standards is that they tend not to be very standardised. The XML format used by Ant’s JUnitReport task has been adopted, extended and bastardised by several different testing tools to the extent that there are at least half a dozen different dialects currently in use. This creates a problem for tools like Hudson that try to parse this inconsistent output. Currently Hudson works correctly with the XML from JUnit, TestNG (including ReportNG) and some other tools but it doesn’t recognise the output from Google Test or PHPUnit.
I was going to make the necessary changes to Hudson so that it accepts the PHPUnit and Google Test variants but I had some problems getting Hudson to build (yay Maven!). I may return to implementing this fix later but for now I’ve used a quick and dirty hack that massages PHPUnit’s output into a form more acceptable to Hudson. Since I’m invoking PHPUnit from a shell script, I can use sed to make the necessary modifications. In PHPUnit’s case, I just need to eliminate the nesting of <testsuite>
tags, which can be done by deleting the third and penultimate lines of the XML file:
# Tweak the test result XML to make it acceptable to Hudson. lines=`wc -l test-results/results.xml|awk '{print $1}'` end=`expr $lines - 1` sed -i "$end d;3d" test-results/results.xml |