Could not transform the NUnit report

Could not transform the NUnit report

30 November 2014

I was stumped by my idiocy on this issue! I spent a couple of hours scratching my head wondering why my NUnit publishing step failed.

Here is my stack trace.

Recording NUnit tests results
ERROR: Publisher hudson.plugins.nunit.NUnitPublisher aborted due to exception
hudson.util.IOException2: Could not transform the NUnit report. Please report this issue to the plugin author
    at hudson.plugins.nunit.NUnitArchiver.invoke(NUnitArchiver.java:60)
    at hudson.plugins.nunit.NUnitArchiver.invoke(NUnitArchiver.java:26)
    at hudson.FilePath.act(FilePath.java:920)
    at hudson.FilePath.act(FilePath.java:893)
    at hudson.plugins.nunit.NUnitPublisher.perform(NUnitPublisher.java:116)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:772)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:736)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:685)
    at hudson.model.Run.execute(Run.java:1757)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)
Caused by: org.xml.sax.SAXParseException; systemId: file:/E:/JenkinsServer/jobs/Cols-Test/workspace/temporary-junit-reports/temp-junit.xml; lineNumber: 8; columnNumber: 3; Premature end of file.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
    at hudson.plugins.nunit.NUnitReportTransformer.splitJUnitFile(NUnitReportTransformer.java:102)
    at hudson.plugins.nunit.NUnitReportTransformer.transform(NUnitReportTransformer.java:72)
    at hudson.plugins.nunit.NUnitArchiver.invoke(NUnitArchiver.java:55)
    ... 13 more
Finished: FAILURE

My Test report XMLs fileset was like **/TestResults/*.*/xml. It happens this path is quite wide and included some JUnit reports which are a different format than NUnit causing this failure. My .NET project was pulling in a library for which I accidentally committed the test reports (not added to .gitignore).

Example:

/foo/bar/TestsResults/foo.xml
/bar/TestsResults/bar.xml
.NET CI Jenkins-CI NUnit Testing