Do you know why Bamboo is having trouble parsing these JUnit.xml files?
Asked by Glen Sonnenberg:

I'm getting errors in my logs about parsing two junit.xml files. What's strange is that it doesn't fail the build even though there are failures inside the files. The files are below. Any ideas?

<br />

Glen Sonnenbeg

\*\*\*

Filename: run-PDIMay9.xml

\<?xml version="1.0" encoding="UTF-8"?\>

\<testsuites tests="17" failures="10" errors="0" name="PDIMay9-Traffic Reports"\>

\<testsuite name="drill-down Traffic Reports" tests="4" failures="3" errors="0"\>

\<testcase name="exportingRouterToexportingLink" status="run" timestamp="1304964300"\>

\<failure message="Files ../databases/PDIMay9/drill-down/tmp/exportingRouterToexportingLink-1304964300.res and ../databases/PDIMay9/drill-down/expected/1304964300/exportingRouterToexportingLink.out differ

" type=""\>

\</testcase\>

\<testcase name="linkToflowRecorder" status="run" timestamp="1304964300"\>

\<failure message="Files ../databases/PDIMay9/drill-down/tmp/linkToflowRecorder-1304964300.res and ../databases/PDIMay9/drill-down/expected/1304964300/linkToflowRecorder.out differ

" type=""\>

\</testcase\>

\<testcase name="exportingRouterToegressPE" status="run" timestamp="1304964300"\>

\</testcase\>

\<testcase name="exportingRouterToflow" status="run" timestamp="1304964300"\>

\<failure message="Files ../databases/PDIMay9/drill-down/tmp/exportingRouterToflow-1304964300.res and ../databases/PDIMay9/drill-down/expected/1304964300/exportingRouterToflow.out differ

" type=""\>

\</testcase\>

\</testsuite\>

\<testsuite name="top-level Traffic Reports" tests="10" failures="5" errors="0"\>

\<testcase name="exportingLink" status="run" timestamp="1304964300"\>

\<failure message="Files ../databases/PDIMay9/top-level/tmp/exportingLink-1304964300.res and ../databases/PDIMay9/top-level/expected/1304964300/exportingLink.out differ

" type=""\>

\</testcase\>

\<testcase name="exportingRouter" status="run" timestamp="1304964300"\>

\</testcase\>

\<testcase name="flowRecorder" status="run" timestamp="1304964300"\>

\</testcase\>

\<testcase name="link" status="run" timestamp="1304964300"\>

\<failure message="Files ../databases/PDIMay9/top-level/tmp/link-1304964300.res and ../databases/PDIMay9/top-level/expected/1304964300/link.out differ

" type=""\>

\</testcase\>

\<testcase name="routerGroupTotal" status="run" timestamp="1304964300"\>

\</testcase\>

\<testcase name="routerTotalTraffic" status="run" timestamp="1304964300"\>

\<failure message="Files ../databases/PDIMay9/top-level/tmp/routerTotalTraffic-1304964300.res and ../databases/PDIMay9/top-level/expected/1304964300/routerTotalTraffic.out differ

" type=""\>

\</testcase\>

\<testcase name="trafficType" status="run" timestamp="1304964300"\>

\<failure message="Files ../databases/PDIMay9/top-level/tmp/trafficType-1304964300.res and ../databases/PDIMay9/top-level/expected/1304964300/trafficType.out differ

" type=""\>

\</testcase\>

\<testcase name="tunnel" status="run" timestamp="1304964300"\>

\</testcase\>

\<testcase name="cosGroup" status="run" timestamp="1304964300"\>

\</testcase\>

\<testcase name="egressRouter" status="run" timestamp="1304964300"\>

\<failure message="Files ../databases/PDIMay9/top-level/tmp/egressRouter-1304964300.res and ../databases/PDIMay9/top-level/expected/1304964300/egressRouter.out differ

" type=""\>

\</testcase\>

\</testsuite\>

\<testsuite name="other Traffic Reports" tests="3" failures="2" errors="0"\>

\<testcase name="exportingRouterToexportingLink" status="run" timestamp="1304964300"\>

\<failure message="Files ../databases/PDIMay9/other/tmp/exportingRouterToexportingLink-1304964300.res and ../databases/PDIMay9/other/expected/1304964300/exportingRouterToexportingLink.out differ

" type=""\>

\</testcase\>

\<testcase name="exportingRouterToegressPE" status="run" timestamp="1304964300"\>

\</testcase\>

\<testcase name="linkToflowRecorder" status="run" timestamp="1304964300"\>

\<failure message="Files ../databases/PDIMay9/other/tmp/linkToflowRecorder-1304964300.res and ../databases/PDIMay9/other/expected/1304964300/linkToflowRecorder.out differ

" type=""\>

\</testcase\>

\</testsuite\>

\</testsuites\>

\*\*\*

Filename: run-BTIrelandBkup.xml

\<?xml version="1.0" encoding="UTF-8"?\>

\<testsuites tests="14" failures="5" errors="0" name="BTIrelandBkup-Traffic Reports"\>

\<testsuite name="drill-down Traffic Reports" tests="4" failures="1" errors="0"\>

\<testcase name="exportingRouterToexportingLink" status="run" timestamp="1411905900"\>

\</testcase\>

\<testcase name="exportingRouterToexportingLinkToflow" status="run" timestamp="1411905900"\>

\<failure message="Files ../databases/BTIrelandBkup/drill-down/tmp/exportingRouterToexportingLinkToflow-1411905900.res and ../databases/BTIrelandBkup/drill-down/expected/1411905900/exportingRouterToexportingLinkToflow.out differ

" type=""\>

\</testcase\>

\<testcase name="linkToflowRecorder" status="run" timestamp="1411905900"\>

\</testcase\>

\<testcase name="exportingRouterToflow" status="run" timestamp="1411905900"\>

\</testcase\>

\</testsuite\>

\<testsuite name="top-level Traffic Reports" tests="8" failures="4" errors="0"\>

\<testcase name="exportingLink" status="run" timestamp="1411905900"\>

\</testcase\>

\<testcase name="exportingRouter" status="run" timestamp="1411905900"\>

\</testcase\>

\<testcase name="flowRecorder" status="run" timestamp="1411905900"\>

\</testcase\>

\<testcase name="link" status="run" timestamp="1411905900"\>

\<failure message="Files ../databases/BTIrelandBkup/top-level/tmp/link-1411905900.res and ../databases/BTIrelandBkup/top-level/expected/1411905900/link.out differ

" type=""\>

\</testcase\>

\<testcase name="routerTotalTraffic" status="run" timestamp="1411905900"\>

\<failure message="Files ../databases/BTIrelandBkup/top-level/tmp/routerTotalTraffic-1411905900.res and ../databases/BTIrelandBkup/top-level/expected/1411905900/routerTotalTraffic.out differ

" type=""\>

\</testcase\>

\<testcase name="trafficType" status="run" timestamp="1411905900"\>

\<failure message="Files ../databases/BTIrelandBkup/top-level/tmp/trafficType-1411905900.res and ../databases/BTIrelandBkup/top-level/expected/1411905900/trafficType.out differ

" type=""\>

\</testcase\>

\<testcase name="tunnel" status="run" timestamp="1411905900"\>

\</testcase\>

\<testcase name="egressRouter" status="run" timestamp="1411905900"\>

\<failure message="Files ../databases/BTIrelandBkup/top-level/tmp/egressRouter-1411905900.res and ../databases/BTIrelandBkup/top-level/expected/1411905900/egressRouter.out differ

" type=""\>

\</testcase\>

\</testsuite\>

\<testsuite name="other Traffic Reports" tests="2" failures="0" errors="0"\>

\<testcase name="exportingRouterToexportingLink" status="run" timestamp="1411905900"\>

\</testcase\>

\<testcase name="linkToflowRecorder" status="run" timestamp="1411905900"\>

\</testcase\>

\</testsuite\>

\</testsuites\>


Answers:
author: Marcin Oles
body: It looks like your JUnit report files are not valid XML files. There are "\<failure\>" tags which aren't closed. Bamboo won't be able to parse them.

In Bamboo you can see this:

```
Failed to parse test result file "&lt;path-to-xml-file&gt;"
```

In application logs you can find this:

```
org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 11; The element type "failure" must be terminated by the matching end-tag "&lt;/failure&gt;".
```

I've tested it and if you close all the invalid tags (either way: "\<failure\>\</failure\>" or "\<failure/\>"), Bamboo parses those results properly.


Tags: cloud