XML format specification (DTD, XSD..) for Unit Test Reports

岁酱吖の 提交于 2020-01-03 08:13:12

问题


A lot of tools produces and consumes the same XML File format for Unit Test report.

Example (source):

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="0" failures="0" hostname="hazelnut.osuosl.org" name="net.cars.engine.MoteurTest" tests="6" time="0.021" timestamp="2007-11-02T23:13:50">
  <properties>
    <property name="java.vendor" value="IBM Corporation" />
    <property name="os.name" value="Linux" />
    <!-- more property tags-->
  </properties>
  <testcase classname="net.cars.engine.MoteurTest" name="hasBougie" time="0.0010" />
  <testcase classname="net.cars.engine.MoteurTest" name="hasCarburatueur" time="0.0010" />
  <!-- more testcase tags-->
  <system-out><![CDATA[]]></system-out>
  <system-err><![CDATA[]]></system-err>
</testsuite>

After a little bit research, I have found that the format was proposed by the apache foundation (by the ant project).

Produced by:

  • junit ant task
  • antunit
  • maven surefire
  • testng
  • ...

Consumed by:

  • junitreport ant task
  • maven surefire-reports
  • CruiseControl
  • Luntbuild
  • Bamboo
  • Hudson/Jenkins
  • IntelliJ TeamCity
  • AntHill
  • Parabuild
  • JUnit PDF Report
  • ...

The only document I could find is this page on the ant wiki: Proposals/EnhancedTestReports

Is there any specification of this format (DTD, XSD) ?

I want to write a such file from hand... (or maybe use a librairy if you know any)...


回答1:


This page http://windyroad.org/2011/02/07/apache-ant-junit-xml-schema/ suggests that the XML Schema for JUnit test reports is here http://windyroad.org/dl/Open%20Source/JUnit.xsd

The structure of that schema seems to match the example you have given.




回答2:


Schema can be found in maven surefire documentation or in the source repository



来源:https://stackoverflow.com/questions/8079071/xml-format-specification-dtd-xsd-for-unit-test-reports

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!