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-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to