XSD validation for junit report

661 views
Skip to first unread message

Erwan de FERRIERES

unread,
May 28, 2013, 10:49:34 AM5/28/13
to casp...@googlegroups.com
Hi,

I'm trying to use the JUnit parser with bamboo and my casperjs tests.

Using the master branch (1.1.0-DEV), I'm getting this result :
<?xml version="1.0" encoding="UTF-8"?>
<testsuites duration="8.321">
<testsuite name="Untitled suite in demo.js" tests="1" failures="0" errors="0" time="6.469" timestamp="2013-05-28T11:47:57.440Z" package="demo/demo">
<testcase name="Subject equals the expected value" classname="demo/demo" time="6.469"></testcase>
<system-out></system-out>
</testsuite>
<testsuite name="Untitled suite in demofunctional.js" tests="5" failures="0" errors="0" time="1.852" timestamp="2013-05-28T11:47:57.441Z" package="demo/demofunctional">
<testcase name="google homepage title is the one expected" classname="demo/demofunctional" time="0.499"></testcase>
<testcase name="main form is found" classname="demo/demofunctional" time="0.001"></testcase>
<testcase name="google title is ok" classname="demo/demofunctional" time="1.35"></testcase>
<testcase name="search term has been submitted" classname="demo/demofunctional" time="0.001">
</testcase><testcase name="google search for &quot;foo&quot; retrieves 10 or more results" classname="demo/demofunctional" time="0.001"></testcase>
<system-out>done() `planned` arg is deprecated as of 1.1</system-out>
</testsuite>
</testsuites>

Bamboo is telling me that he can't find any test results :
command	28-May-2013 13:59:47	Substituting variable: ${bamboo.build.working.directory} with /mnt/bamboo-ebs/bamboo-agent/build-dir/XXXXXXXXX
simple	28-May-2013 13:59:47	Starting task 'JUnit Parser' of type 'com.atlassian.bamboo.plugins.testresultparser:task.testresultparser.junit'
simple	28-May-2013 13:59:47	Parsing test results...
simple	28-May-2013 13:59:47	Failing task since test cases were expected but none were found.
simple	28-May-2013 13:59:47	Finished task 'JUnit Parser'

When validating the XML output using http://www.freeformatter.com/xml-validator-xsd.html and this XSD http://windyroad.com.au/dl/Open%20Source/JUnit.xsd, here are the errors I got :
  • Cvc-complex-type.3.2.2: Attribute 'duration' Is Not Allowed To Appear In Element 'testsuites'.. Line '2', Column '30'.
  • Cvc-pattern-valid: Value '2013-05-28T11:47:57.440Z' Is Not Facet-valid With Respect To Pattern '[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}' For Type 'ISO8601_DATETIME_PATTERN'.. Line '3', Column '188'.
  • Cvc-attribute.3: The Value '2013-05-28T11:47:57.440Z' Of Attribute 'timestamp' On Element 'testsuite' Is Not Valid With Respect To Its Type, 'ISO8601_DATETIME_PATTERN'.. Line '3', Column '188'.
  • Cvc-complex-type.4: Attribute 'id' Must Appear On Element 'testsuite'.. Line '3', Column '188'.
  • Cvc-complex-type.4: Attribute 'hostname' Must Appear On Element 'testsuite'.. Line '3', Column '188'.
  • Cvc-complex-type.2.4.a: Invalid Content Was Found Starting With Element 'testcase'. One Of '{properties}' Is Expected.. Line '4', Column '89'.
  • Cvc-pattern-valid: Value '2013-05-28T11:47:57.441Z' Is Not Facet-valid With Respect To Pattern '[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}' For Type 'ISO8601_DATETIME_PATTERN'.. Line '7', Column '208'.
  • Cvc-attribute.3: The Value '2013-05-28T11:47:57.441Z' Of Attribute 'timestamp' On Element 'testsuite' Is Not Valid With Respect To Its Type, 'ISO8601_DATETIME_PATTERN'.. Line '7', Column '208'.
  • Cvc-complex-type.4: Attribute 'id' Must Appear On Element 'testsuite'.. Line '7', Column '208'.
  • Cvc-complex-type.4: Attribute 'hostname' Must Appear On Element 'testsuite'.. Line '7', Column '208'.
  • Cvc-complex-type.2.4.a: Invalid Content Was Found Starting With Element 'testcase'. One Of '{properties}' Is Expected.. Line '8', Column '107'.

My thoughts are that the wrong format is making bamboo refusing to parse the file.

Has anyone got this error ? Or am I wrongly configuring the task ?

Cheers,

Erwan

Nicolas Perriault

unread,
May 29, 2013, 2:57:09 AM5/29/13
to casp...@googlegroups.com
On Tue, May 28, 2013 at 4:49 PM, Erwan de FERRIERES
<erwan.de...@gmail.com> wrote:

> I'm trying to use the JUnit parser with bamboo and my casperjs tests.

First, I have no idea what Bamboo is, all I know is the XUnit output
casperjs generates is transparently consumed by Jenkins, my reference
target implementation.

I never found any official XSD for JUnit XML spec, so I don't know how
accurate and mainsteam the one you've found actually is.

What I need here:

- to ensure keeping full compatibilty with Jenkins
- if previous point is OK, send a pull request with required modifications

Thanks for your understanding.

++

--
Nicolas Perriault
https://nicolas.perriault.net/
Phone: +33 (0) 660 92 08 67

Erwan de FERRIERES

unread,
May 29, 2013, 11:46:32 AM5/29/13
to casp...@googlegroups.com, nic...@perriault.net

Hi Nicolas,

thanks for your answer. I tried with jenkins, and for both 1.0.2 and 1.1-DEV, the xunit report is working well. So I looked deeper in my configuration.
Bamboo is a CI tool, like jenkins, but made by Atlassian.
Anyway, I found the error was coming from me, so I corrected it.

Thanks again !

Simon Hooker

unread,
Sep 7, 2015, 11:08:07 AM9/7/15
to CasperJS, nic...@perriault.net
Hi Erwan,

How did you fix this?  I am trying to get CasperJS to play nicely with Bamboo at present but so far am just finding people saying that they've fixed it without going on to give any clue as to what they did to fix it!

Simon Hooker

unread,
Sep 7, 2015, 11:44:46 AM9/7/15
to CasperJS, nic...@perriault.net
Never mind,

Turns out that the script block where I was running casperjs tests was returning a "fail" code because the final command was a failing CasperJS test and so it never even tried to parse results as jUnit.

Adding an 'echo "Done"' to the end of the script block therefore returning a success error code allowed it to proceed as expected to parse results (and failures)
Reply all
Reply to author
Forward
0 new messages