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<http://stacktrace.jenkins-ci.org/search?query=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)
>
> <http://stacktrace.jenkins-ci.org/search/?query=org.dom4j.io.SAXReader.read&entity=method>at
>  
> org.dom4j.io.SAXReader.read(SAXReader.java:264)
>
> <http://stacktrace.jenkins-ci.org/search/?query=org.dom4j.io.SAXReader.read&entity=method>at
>  
> hudson.tasks.junit.SuiteResult.parse(SuiteResult.java:112)
>
> <http://stacktrace.jenkins-ci.org/search/?query=hudson.tasks.junit.SuiteResult.parse&entity=method>at
>  
> hudson.tasks.junit.TestResult.parse(TestResult.java:208)
>
> <http://stacktrace.jenkins-ci.org/search/?query=hudson.tasks.junit.TestResult.parse&entity=method>...
>  15 more
> Caused by: 
> org.xml.sax.SAXParseException<http://stacktrace.jenkins-ci.org/search?query=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?

Reply via email to