Skip to content

Commit

Permalink
Update NUnitXml.xslt to emit properties element before reason/failure (
Browse files Browse the repository at this point in the history
…#1797)

The NUnit 2.5 schema at http://nunit.org/files/testresult_schema_25.txt specifies
that the test-case element should look like this:

```xml
<xs:complexType name="test-caseType">
    <xs:sequence>
        <xs:element name="categories" type="categoriesType" minOccurs="0" maxOccurs="1" />
        <xs:element name="properties" type="propertiesType" 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" />
    ...
```

The usage of xs:sequence means categories, properties and failure/reason elements
need to be emitted in exactly that order.

Currently NUnitXml.xslt however emits the properties _after_ the reason element.

This fixes the xslt to emit properties in the expected order.
  • Loading branch information
akoeplinger authored and bradwilson committed Aug 22, 2018
1 parent 1d008e3 commit aa79468
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/xunit.console/NUnitXml.xslt
Expand Up @@ -128,14 +128,14 @@
<xsl:value-of select="@time"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="traits"/>
<xsl:if test="reason">
<reason>
<message>
<xsl:apply-templates select="reason"/>
</message>
</reason>
</xsl:if>
<xsl:apply-templates select="traits"/>
<xsl:apply-templates select="failure"/>
</test-case>
</xsl:template>
Expand Down Expand Up @@ -163,4 +163,4 @@
</failure>
</xsl:template>

</xsl:stylesheet>
</xsl:stylesheet>

0 comments on commit aa79468

Please sign in to comment.