All of the junit compatible XML files I could find have only a single testsuite. That includes samples from JUnit, py.test, and nose.
Could you express your tests as a single root testsuite with multiple testcases beneath the testsuite? Could you alter your use of your custom XMLPrinter to write a new file each time it encounters a new testsuite, then use the wildcard matching in Jenkins test file result selection to find any files it creates? There is an indication that the format generated by JUnit only allows a single root level testsuite. Refer to : http://mail-archives.apache.org/mod_mbox/ant-dev/200902.mbox/%3cdffc72020902241548l4316d645w2e98caf5f0aac...@mail.gmail.com%3E That same mail message mentions that junitreport has a different format. I don't know if Jenkins handles the junitreport format. Mark Waite >________________________________ > From: CB <c.rooste...@gmail.com> >To: jenkinsci-users@googlegroups.com >Sent: Tuesday, July 3, 2012 9:08 AM >Subject: Publish JUnit test result report containing multiple testsuites > > >I have cxxtest unit tests publishing JUnit-like output using a custom >XmlPrinter. A few test files contain multiple testsuites, causing an xml >output with multiple <testsuite> elements, example; > > ><?xml version="1.0" encoding="UTF-8" ?> > <testsuite name="FooTest" file="CombinedTest.h" line="20"> > <testcase name="testCtor1" line="25"> > </testcase> > <!-- snip --> > </testsuite> > <testsuite name="BarTest" file="CombinedTest.h" line="390"> > <testcase name="testCtor1" line="395"> > </testcase> <!-- snip --> > </testsuite> > > >However, Jenkins Junit publisher chokes on these files, with > > >Caused by: org.dom4j.DocumentException: Error on line 70 of document >>The markup in the document following the root element must be well-formed. >>Nested exception: The markup in the document following the root element must >>be well-formed. >>at org.dom4j.io.SAXReader.read(SAXReader.java:482) >> at org.dom4j.io.SAXReader.read(SAXReader.java:264) >> at hudson.tasks.junit.SuiteResult.parse(SuiteResult.java:112) >> at hudson.tasks.junit.TestResult.parse(TestResult.java:208) >> ... 15 more >>Caused by: org.xml.sax.SAXParseException: The markup in the document >>following the root element must be well-formed. > > > > >Is there an easy way around this without restructuring my test files? > >