You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Peter Reilly <pe...@gmail.com> on 2009/02/25 00:48:24 UTC
schema for junit xml output
a question that has been asked a number of times on the hudson mailing
list is what
is the schema of tthe xml that junit generates.
I have had a quick look at the code, and noticed that there two related schemas.
1) the xml that <junit> generates
and
2) the xml that <junitreport> uses internally.
Both these formats are used as input to other reporting tools -
including hudson.
(I assume that maven has a similar junit xml report format)
The xml that <junit> generates has a toplevel element of <testsuite> and nested
<properties>, <testcase>, <system-out> and <system-err> elements.
The xml that <junitreport> uses internally has a toploevel element of
<testsuites> and nested
<testsuite> elements. The content of these <testsuite> elements are the same as
the <testsuite> from the task <junit> *except* that it has two extra
attributes - "id" and "package"..
In any case, here is a first attempt at a schema for junit (in relaxng
compact syntax)
junit.rnc:
#----------------------------------------------------------------------------------
start = testsuite
property = element property {
attribute name {text},
attribute value {text}
}
properties = element properties {
property*
}
failure = element failure {
attribute message {text},
attribute type {text},
text
}
testcase = element testcase {
attribute classname {text},
attribute name {text},
attribute time {text},
failure?
}
testsuite = element testsuite {
attribute errors {xsd:integer},
attribute failures {xsd:integer},
attribute hostname {text},
attribute name {text},
attribute tests {xsd:integer},
attribute time {xsd:double},
attribute timestamp {xsd:dateTime},
properties,
testcase*,
element system-out {text},
element system-err {text}
}
#----------------------------------------------------------------------------------
and junitreport.rnc
#----------------------------------------------------------------------------------
include "junit.rnc" {
start = testsuites
testsuite = element testsuite {
attribute errors {xsd:integer},
attribute failures {xsd:integer},
attribute hostname {text},
attribute name {text},
attribute tests {xsd:integer},
attribute time {xsd:double},
attribute timestamp {xsd:dateTime},
attribute id {text},
attribute package {text},
properties,
testcase*,
element system-out {text},
element system-err {text}
}
}
testsuites = element testsuites {
testsuite*
}
#----------------------------------------------------------------------------------
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: schema for junit xml output
Posted by Stefan Bodewig <bo...@apache.org>.
Looks good to me.
Might be worth to add it to src/etc.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: schema for junit xml output
Posted by Steve Loughran <st...@apache.org>.
Peter Reilly wrote:
> The google-test people are going to to change the output from
> <testsuite><testsuite*/></testsuite> to
> <testsuites><testsuite*/></testsuites>
> (with a command-line switch).
>
> They have some extra attributes, and do not populate some attributes
> and elements. but the output is understood by hudson without mod to
> hudson.
>
well, all the tools are one XSLT away from each other.
TestNG has an extended format with for their non-compatible runs, with
explicit skip flags, and I think every text can have a description
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: schema for junit xml output
Posted by Peter Reilly <pe...@gmail.com>.
The google-test people are going to to change the output from
<testsuite><testsuite*/></testsuite> to
<testsuites><testsuite*/></testsuites>
(with a command-line switch).
They have some extra attributes, and do not populate some attributes
and elements. but the output is understood by hudson without mod to
hudson.
Peter.
On Wed, Mar 18, 2009 at 3:50 PM, Jesse Glick <je...@sun.com> wrote:
> Peter Reilly wrote:
>>
>> a question that has been asked a number of times on the hudson mailing
>> list is what is the schema of the xml that junit generates.
>
> BTW:
>
> https://hudson.dev.java.net/nonav/issues/show_bug.cgi?id=3007
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: schema for junit xml output
Posted by Jesse Glick <je...@sun.com>.
Peter Reilly wrote:
> a question that has been asked a number of times on the hudson mailing list is what is the schema of the xml that junit generates.
BTW:
https://hudson.dev.java.net/nonav/issues/show_bug.cgi?id=3007
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: schema for junit xml output
Posted by Jesse Glick <je...@sun.com>.
Peter Reilly wrote:
> In any case, here is a first attempt at a schema for junit (in relaxng
> compact syntax)
If you are going to declare an official schema, I would recommend making <junit> and <junitreport> enforce it at runtime, at least in development builds (or if assertions
are enabled etc.). Otherwise the danger is high that some "little" change in the tasks will in fact cause unintentional schema drift.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org