Skip to content
Permalink
Browse files

[JENKINS-51481] Parse error occur when NUnit report have categories

Create a new XSD compatible with all 2.x NUnit version (gathered NUnit XSD version from official distribution archive). Rewrite the XSL file to create a more complete JUnit report to support also categories and more.
  • Loading branch information...
nfalco79 committed May 27, 2018
1 parent 850a7bb commit a97f56a2c67185cff9bd6349f41b7bd819d5844e
Showing with 1,464 additions and 170 deletions.
  1. +4 −3 src/main/java/org/jenkinsci/plugins/xunit/types/NUnit.java
  2. +44 −31 src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd
  3. 0 ...n/resources/org/jenkinsci/plugins/xunit/types/{nunit-1.0-to-junit-2.xsl → nunit-1.0-to-junit.xsl}
  4. +54 −0 src/main/resources/org/jenkinsci/plugins/xunit/types/nunit-2.1.xsd
  5. +86 −0 src/main/resources/org/jenkinsci/plugins/xunit/types/nunit-2.2.xsd
  6. +70 −0 src/main/resources/org/jenkinsci/plugins/xunit/types/nunit-2.4.xsd
  7. +108 −0 src/main/resources/org/jenkinsci/plugins/xunit/types/nunit-2.5.xsd
  8. +108 −0 src/main/resources/org/jenkinsci/plugins/xunit/types/nunit-2.6.xsd
  9. +198 −0 src/main/resources/org/jenkinsci/plugins/xunit/types/nunit-2.x-to-junit.xsl
  10. +108 −0 src/main/resources/org/jenkinsci/plugins/xunit/types/nunit-2.x.xsd
  11. +4 −1 src/test/java/org/jenkinsci/plugins/xunit/types/NUnitTest.java
  12. +3 −8 src/test/resources/org/jenkinsci/plugins/xunit/types/junit/testcase1/input.xml
  13. +2 −2 src/test/resources/org/jenkinsci/plugins/xunit/types/junit/testcase3/input.xml
  14. +0 −49 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/NUnit.xml
  15. +0 −33 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/NUnitUnicode.xml
  16. +100 −0 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/testcase10/input.xml
  17. +21 −0 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/testcase10/result.xml
  18. +7 −12 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/testcase2/input.xml
  19. +7 −15 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/testcase2/result.xml
  20. +12 −10 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/testcase5/input.xml
  21. +4 −0 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/testcase6/input.xml
  22. +2 −6 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/testcase7/result.xml
  23. +190 −0 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/testcase8/input.xml
  24. +70 −0 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/testcase8/result.xml
  25. +103 −0 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/testcase9/input.xml
  26. +34 −0 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit/testcase9/result.xml
  27. +125 −0 src/test/resources/org/jenkinsci/plugins/xunit/types/nunit3/testcase3/input.xml
@@ -42,7 +42,7 @@ public String getToolName() {

@Override
public String getToolVersion() {
return "2";
return "2.x";
}

@Override
@@ -52,14 +52,15 @@ public boolean isDefault() {

@Override
public String getXslName() {
return "nunit-1.0-to-junit-2.xsl";
return "nunit-2.x-to-junit.xsl";
}

@Override
public String[] getInputXsdNameList() {
return null;
return new String[] { "nunit-2.x.xsd" };
}

@Override
public OutputMetric getOutputFormatType() {
return JUnitModel.LATEST;
}
@@ -26,22 +26,22 @@ THE SOFTWARE.

<xs:element name="failure">
<xs:complexType mixed="true">
<xs:attribute name="type" type="xs:string" use="optional"/>
<xs:attribute name="message" type="xs:string" use="optional"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="message" type="xs:string"/>
</xs:complexType>
</xs:element>

<xs:element name="error">
<xs:complexType mixed="true">
<xs:attribute name="type" type="xs:string" use="optional"/>
<xs:attribute name="message" type="xs:string" use="optional"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="message" type="xs:string"/>
</xs:complexType>
</xs:element>

<xs:element name="skipped">
<xs:complexType mixed="true">
<xs:attribute name="type" type="xs:string" use="optional"/>
<xs:attribute name="message" type="xs:string" use="optional"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="message" type="xs:string"/>
</xs:complexType>
</xs:element>

@@ -71,8 +71,8 @@ THE SOFTWARE.
<xs:element ref="system-err" />
</xs:choice>
</xs:sequence>
<xs:attribute name="type" type="xs:string" use="optional"/>
<xs:attribute name="message" type="xs:string" use="optional"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="message" type="xs:string"/>
</xs:complexType>
</xs:element>

@@ -84,8 +84,8 @@ THE SOFTWARE.
<xs:element ref="system-err" />
</xs:choice>
</xs:sequence>
<xs:attribute name="type" type="xs:string" use="optional"/>
<xs:attribute name="message" type="xs:string" use="optional"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="message" type="xs:string"/>
</xs:complexType>
</xs:element>

@@ -103,9 +103,9 @@ THE SOFTWARE.
</xs:choice>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="time" type="xs:string" use="optional"/>
<xs:attribute name="classname" type="xs:string" use="optional"/>
<xs:attribute name="group" type="xs:string" use="optional"/>
<xs:attribute name="time" type="xs:string"/>
<xs:attribute name="classname" type="xs:string"/>
<xs:attribute name="group" type="xs:string"/>
</xs:complexType>
</xs:element>

@@ -118,32 +118,45 @@ THE SOFTWARE.
<xs:element ref="system-out"/>
<xs:element ref="system-err"/>
</xs:choice>
<xs:attribute name="name" type="xs:string" use="optional"/>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="tests" type="xs:string" use="required"/>
<xs:attribute name="failures" type="xs:string" use="optional"/>
<xs:attribute name="errors" type="xs:string" use="optional"/>
<xs:attribute name="time" type="xs:string" use="optional"/>
<xs:attribute name="skipped" type="xs:string" use="optional"/>
<xs:attribute name="timestamp" type="xs:string" use="optional"/>
<xs:attribute name="hostname" type="xs:string" use="optional"/>
<xs:attribute name="id" type="xs:string" use="optional"/>
<xs:attribute name="package" type="xs:string" use="optional"/>
<xs:attribute name="file" type="xs:string" use="optional"/>
<xs:attribute name="log" type="xs:string" use="optional"/>
<xs:attribute name="url" type="xs:string" use="optional"/>
<xs:attribute name="failures" type="xs:string" use="required"/>
<xs:attribute name="errors" type="xs:string" use="required"/>
<xs:attribute name="group" type="xs:string" />
<xs:attribute name="time">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="(([0-9]{0,3},)*[0-9]{3}|[0-9]{0,3})*(\.[0-9]{0,3})?" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="skipped" type="xs:string" />
<xs:attribute name="timestamp" type="xs:string" />
<xs:attribute name="hostname" type="xs:string" />
<xs:attribute name="id" type="xs:string" />
<xs:attribute name="package" type="xs:string" />
<xs:attribute name="file" type="xs:string"/>
<xs:attribute name="log" type="xs:string"/>
<xs:attribute name="url" type="xs:string"/>
</xs:complexType>
</xs:element>

<xs:element name="testsuites">
<xs:complexType>
<xs:sequence>
<xs:element ref="testsuite" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="testsuite" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="optional"/>
<xs:attribute name="time" type="xs:string" use="optional"/>
<xs:attribute name="tests" type="xs:string" use="optional"/>
<xs:attribute name="failures" type="xs:string" use="optional"/>
<xs:attribute name="errors" type="xs:string" use="optional"/>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="time">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="(([0-9]{0,3},)*[0-9]{3}|[0-9]{0,3})*(\.[0-9]{0,3})?" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="tests" type="xs:string" />
<xs:attribute name="failures" type="xs:string" />
<xs:attribute name="errors" type="xs:string" />
</xs:complexType>
</xs:element>

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:complexType name="failureType">
<xs:sequence>
<xs:element ref="message" />
<xs:element ref="stack-trace" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="reasonType">
<xs:sequence>
<xs:element ref="message" />
</xs:sequence>
</xs:complexType>
<xs:element name="message" type="xs:string" />
<xs:complexType name="resultsType">
<xs:choice>
<xs:element name="test-suite" type="test-suiteType" maxOccurs="unbounded" />
<xs:element name="test-case" type="test-caseType" maxOccurs="unbounded" minOccurs="0" />
</xs:choice>
</xs:complexType>
<xs:element name="stack-trace" type="xs:string" />
<xs:element name="test-results" type="resultType" />
<xs:complexType name="resultType">
<xs:sequence>
<xs:element name="test-suite" type="test-suiteType" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="total" type="xs:decimal" use="required" />
<xs:attribute name="failures" type="xs:decimal" use="required" />
<xs:attribute name="not-run" type="xs:decimal" use="required" />
<xs:attribute name="date" type="xs:string" use="required" />
<xs:attribute name="time" type="xs:string" use="required" />
</xs:complexType>
<xs:complexType name="test-caseType">
<xs:choice>
<xs:element name="failure" type="failureType" minOccurs="0" />
<xs:element name="reason" type="reasonType" minOccurs="0" />
</xs:choice>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="description" type="xs:string" use="optional" />
<xs:attribute name="success" type="xs:string" use="optional" />
<xs:attribute name="time" type="xs:string" use="optional" />
<xs:attribute name="executed" type="xs:string" use="required" />
</xs:complexType>
<xs:complexType name="test-suiteType">
<xs:sequence>
<xs:element name="results" type="resultsType" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="description" type="xs:string" use="optional" />
<xs:attribute name="success" type="xs:string" use="required" />
<xs:attribute name="time" type="xs:string" use="required" />
</xs:complexType>
</xs:schema>
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:complexType name="failureType">
<xs:sequence>
<xs:element ref="message" />
<xs:element ref="stack-trace" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="reasonType">
<xs:sequence>
<xs:element ref="message" />
</xs:sequence>
</xs:complexType>
<xs:element name="message" type="xs:string" />
<xs:complexType name="resultsType">
<xs:choice>
<xs:element name="test-suite" type="test-suiteType" maxOccurs="unbounded" />
<xs:element name="test-case" type="test-caseType" maxOccurs="unbounded" minOccurs="0" />
</xs:choice>
</xs:complexType>
<xs:element name="stack-trace" type="xs:string" />
<xs:element name="test-results" type="resultType" />
<xs:complexType name="categoriesType">
<xs:sequence>
<xs:element name="category" type="categoryType" maxOccurs="unbounded" minOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="categoryType">
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="environmentType">
<xs:attribute name="nunit-version" type="xs:string" use="required" />
<xs:attribute name="clr-version" type="xs:string" use="required" />
<xs:attribute name="os-version" type="xs:string" use="required" />
<xs:attribute name="platform" type="xs:string" use="required" />
<xs:attribute name="cwd" type="xs:string" use="required" />
<xs:attribute name="machine-name" type="xs:string" use="required" />
<xs:attribute name="user" type="xs:string" use="required" />
<xs:attribute name="user-domain" type="xs:string" use="required" />
</xs:complexType>
<xs:complexType name="culture-infoType" >
<xs:attribute name="current-culture" type="xs:string" use="required" />
<xs:attribute name="current-uiculture" type="xs:string" use="required" />
</xs:complexType>
<xs:complexType name="resultType">
<xs:sequence>
<xs:element name="environment" type="environmentType" />
<xs:element name="culture-info" type="culture-infoType" />
<xs:element name="test-suite" type="test-suiteType" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="total" type="xs:decimal" use="required" />
<xs:attribute name="failures" type="xs:decimal" use="required" />
<xs:attribute name="not-run" type="xs:decimal" use="required" />
<xs:attribute name="date" type="xs:string" use="required" />
<xs:attribute name="time" type="xs:string" use="required" />
</xs:complexType>
<xs:complexType name="test-caseType">
<xs:sequence>
<xs:element name="categories" type="categoriesType" minOccurs="0" maxOccurs="1" />
<xs:choice>
<xs:element name="failure" type="failureType" minOccurs="0" />
<xs:element name="reason" type="reasonType" minOccurs="0" />
</xs:choice>
</xs:sequence>

<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="description" type="xs:string" use="optional" />
<xs:attribute name="success" type="xs:string" use="optional" />
<xs:attribute name="time" type="xs:string" use="optional" />
<xs:attribute name="executed" type="xs:string" use="required" />
<xs:attribute name="asserts" type="xs:string" use="optional" />
</xs:complexType>
<xs:complexType name="test-suiteType">
<xs:sequence>
<xs:element name="categories" type="categoriesType" minOccurs="0" maxOccurs="1" />
<xs:element name="results" type="resultsType" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="description" type="xs:string" use="optional" />
<xs:attribute name="success" type="xs:string" use="required" />
<xs:attribute name="time" type="xs:string" use="required" />
<xs:attribute name="asserts" type="xs:string" use="optional" />
</xs:complexType>

</xs:schema>
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:complexType name="failureType">
<xs:sequence>
<xs:element ref="message" />
<xs:element ref="stack-trace" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="reasonType">
<xs:sequence>
<xs:element ref="message" />
</xs:sequence>
</xs:complexType>
<xs:element name="message" type="xs:string" />
<xs:complexType name="resultsType">
<xs:choice>
<xs:element name="test-suite" type="test-suiteType" maxOccurs="unbounded" />
<xs:element name="test-case" type="test-caseType" maxOccurs="unbounded" minOccurs="0" />
</xs:choice>
</xs:complexType>
<xs:element name="stack-trace" type="xs:string" />
<xs:element name="test-results" type="resultType" />
<xs:complexType name="categoriesType">
<xs:sequence>
<xs:element name="category" type="categoryType" maxOccurs="unbounded" minOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="categoryType">
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="resultType">
<xs:sequence>
<xs:element name="test-suite" type="test-suiteType" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="total" type="xs:decimal" use="required" />
<xs:attribute name="failures" type="xs:decimal" use="required" />
<xs:attribute name="not-run" type="xs:decimal" use="required" />
<xs:attribute name="date" type="xs:string" use="required" />
<xs:attribute name="time" type="xs:string" use="required" />
</xs:complexType>
<xs:complexType name="test-caseType">
<xs:sequence>
<xs:element name="categories" type="categoriesType" minOccurs="0" maxOccurs="1" />
<xs:choice>
<xs:element name="failure" type="failureType" minOccurs="0" />
<xs:element name="reason" type="reasonType" minOccurs="0" />
</xs:choice>
</xs:sequence>

<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="description" type="xs:string" use="optional" />
<xs:attribute name="success" type="xs:string" use="optional" />
<xs:attribute name="time" type="xs:string" use="optional" />
<xs:attribute name="executed" type="xs:string" use="required" />
<xs:attribute name="asserts" type="xs:string" use="optional" />
</xs:complexType>
<xs:complexType name="test-suiteType">
<xs:sequence>
<xs:element name="categories" type="categoriesType" minOccurs="0" maxOccurs="1" />
<xs:element name="results" type="resultsType" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="description" type="xs:string" use="optional" />
<xs:attribute name="success" type="xs:string" use="required" />
<xs:attribute name="time" type="xs:string" use="required" />
<xs:attribute name="asserts" type="xs:string" use="optional" />
</xs:complexType>

</xs:schema>

0 comments on commit a97f56a

Please sign in to comment.
You can’t perform that action at this time.