Add transforms from nunit-summary project

This commit is contained in:
Charlie Poole 2017-05-31 02:48:51 -07:00
Родитель 046b0753a7
Коммит 41c06e2358
8 изменённых файлов: 912 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='text'/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="test-results">
<xsl:text>***** </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>&#xD;&#xA;&#xD;&#xA;</xsl:text>
<xsl:text>NUnit Version </xsl:text>
<xsl:value-of select="environment/@nunit-version"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@date"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@time"/>
<xsl:text>&#xD;&#xA;&#xD;&#xA;</xsl:text>
<xsl:text>Runtime Environment -&#xD;&#xA;</xsl:text>
<xsl:text> OS Version: </xsl:text>
<xsl:value-of select="environment/@os-version"/>
<xsl:text>&#xD;&#xA;</xsl:text>
<xsl:text> CLR Version: </xsl:text>
<xsl:value-of select="environment/@clr-version"/>
<xsl:text>&#xD;&#xA;&#xD;&#xA;</xsl:text>
<xsl:text>Tests run: </xsl:text>
<xsl:value-of select="@total"/>
<xsl:choose>
<xsl:when test ="substring(environment/@nunit-version,1,3)>='2.5'">
<xsl:text>, Errors: </xsl:text>
<xsl:value-of select="@errors"/>
<xsl:text>, Failures: </xsl:text>
<xsl:value-of select="@failures"/>
<xsl:if test="@inconclusive">
<!-- Introduced in 2.5.1 -->
<xsl:text>, Inconclusive: </xsl:text>
<xsl:value-of select="@inconclusive"/>
</xsl:if>
<xsl:text>, Time: </xsl:text>
<xsl:value-of select="test-suite/@time"/>
<xsl:text> seconds&#xD;&#xA;</xsl:text>
<xsl:text> Not run: </xsl:text>
<xsl:value-of select="@not-run"/>
<xsl:text>, Invalid: </xsl:text>
<xsl:value-of select="@invalid"/>
<xsl:text>, Ignored: </xsl:text>
<xsl:value-of select="@ignored"/>
<xsl:text>, Skipped: </xsl:text>
<xsl:value-of select="@skipped"/>
<xsl:text>&#xD;&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>, Failures: </xsl:text>
<xsl:value-of select="@failures"/>
<xsl:text>, Not run: </xsl:text>
<xsl:value-of select="@not-run"/>
<xsl:text>, Time: </xsl:text>
<xsl:value-of select="test-suite/@time"/>
<xsl:text> seconds&#xD;&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='text'/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="test-results">
<xsl:text>***** </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>&#xD;&#xA;&#xD;&#xA;</xsl:text>
<xsl:text>NUnit Version </xsl:text>
<xsl:value-of select="environment/@nunit-version"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@date"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@time"/>
<xsl:text>&#xD;&#xA;&#xD;&#xA;</xsl:text>
<xsl:text>Runtime Environment -&#xD;&#xA;</xsl:text>
<xsl:text> OS Version: </xsl:text>
<xsl:value-of select="environment/@os-version"/>
<xsl:text>&#xD;&#xA;</xsl:text>
<xsl:text> CLR Version: </xsl:text>
<xsl:value-of select="environment/@clr-version"/>
<xsl:text>&#xD;&#xA;&#xD;&#xA;</xsl:text>
<xsl:text>Tests run: </xsl:text>
<xsl:value-of select="@total"/>
<xsl:choose>
<xsl:when test ="substring(environment/@nunit-version,1,3)>='2.5'">
<xsl:text>, Errors: </xsl:text>
<xsl:value-of select="@errors"/>
<xsl:text>, Failures: </xsl:text>
<xsl:value-of select="@failures"/>
<xsl:if test="@inconclusive">
<!-- Introduced in 2.5.1 -->
<xsl:text>, Inconclusive: </xsl:text>
<xsl:value-of select="@inconclusive"/>
</xsl:if>
<xsl:text>, Time: </xsl:text>
<xsl:value-of select="test-suite/@time"/>
<xsl:text> seconds&#xD;&#xA;</xsl:text>
<xsl:text> Not run: </xsl:text>
<xsl:value-of select="@not-run"/>
<xsl:text>, Invalid: </xsl:text>
<xsl:value-of select="@invalid"/>
<xsl:text>, Ignored: </xsl:text>
<xsl:value-of select="@ignored"/>
<xsl:text>, Skipped: </xsl:text>
<xsl:value-of select="@skipped"/>
<xsl:text>&#xD;&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>, Failures: </xsl:text>
<xsl:value-of select="@failures"/>
<xsl:text>, Not run: </xsl:text>
<xsl:value-of select="@not-run"/>
<xsl:text>, Time: </xsl:text>
<xsl:value-of select="test-suite/@time"/>
<xsl:text> seconds&#xD;&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&#xD;&#xA;</xsl:text>
<xsl:if test="//test-case[failure]">
<xsl:text>Failures:&#xD;&#xA;</xsl:text>
</xsl:if>
<xsl:apply-templates select="//test-case[failure]"/>
<xsl:if test="//test-case[@executed='False']">
<xsl:text>Tests not run:&#xD;&#xA;</xsl:text>
</xsl:if>
<xsl:apply-templates select="//test-case[@executed='False']"/>
<xsl:text disable-output-escaping='yes'>&#xD;&#xA;</xsl:text>
</xsl:template>
<xsl:template match="test-case">
<xsl:value-of select="position()"/>
<xsl:text>) </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> : </xsl:text>
<xsl:value-of select="child::node()/message"/>
<xsl:text disable-output-escaping='yes'>&#xD;&#xA;</xsl:text>
<xsl:if test="failure">
<xsl:value-of select="failure/stack-trace"/>
<xsl:text>&#xD;&#xA;</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='text'/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="test-results">
<xsl:text>&lt;b&gt;</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>&lt;/b&gt;&lt;br&gt;&lt;br&gt;&#xD;&#xA;&#xD;&#xA;</xsl:text>
<xsl:text>&lt;b&gt;NUnit Version:&lt;/b&gt; </xsl:text>
<xsl:value-of select="environment/@nunit-version"/>
<xsl:text>&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;Date:&lt;/b&gt; </xsl:text>
<xsl:value-of select="@date"/>
<xsl:text>&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;Time:&lt;/b&gt; </xsl:text>
<xsl:value-of select="@time"/>
<xsl:text>&lt;br&gt;&lt;br&gt;&#xD;&#xA;&#xD;&#xA;</xsl:text>
<xsl:text>&lt;b&gt;Runtime Environment -&lt;/b&gt;&lt;br&gt;&#xD;&#xA;</xsl:text>
<xsl:text>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;OS Version:&lt;/b&gt; </xsl:text>
<xsl:value-of select="environment/@os-version"/>
<xsl:text>&lt;br&gt;&#xD;&#xA;</xsl:text>
<xsl:text>&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;CLR Version:&lt;/b&gt; </xsl:text>
<xsl:value-of select="environment/@clr-version"/>
<xsl:text>&lt;br&gt;&lt;br&gt;&#xD;&#xA;&#xD;&#xA;</xsl:text>
<xsl:text>&lt;b&gt;Tests run: </xsl:text>
<xsl:value-of select="@total"/>
<xsl:choose>
<xsl:when test ="substring(environment/@nunit-version,1,3)>='2.5'">
<xsl:text>, Errors: </xsl:text>
<xsl:value-of select="@errors"/>
<xsl:text>, Failures: </xsl:text>
<xsl:value-of select="@failures"/>
<xsl:if test="@inconclusive">
<!-- Introduced in 2.5.1 -->
<xsl:text>, Inconclusive: </xsl:text>
<xsl:value-of select="@inconclusive"/>
</xsl:if>
<xsl:text>, Time: </xsl:text>
<xsl:value-of select="test-suite/@time"/>
<xsl:text> seconds&lt;br&gt;</xsl:text>
<xsl:text>&amp;nbsp;&amp;nbsp;&amp;nbsp;Not run: </xsl:text>
<xsl:value-of select="@not-run"/>
<xsl:text>, Invalid: </xsl:text>
<xsl:value-of select="@invalid"/>
<xsl:text>, Ignored: </xsl:text>
<xsl:value-of select="@ignored"/>
<xsl:text>, Skipped: </xsl:text>
<xsl:value-of select="@skipped"/>
<xsl:text>&lt;/b&gt;&lt;br&gt;&lt;br&gt;&#xD;&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>, Failures: </xsl:text>
<xsl:value-of select="@failures"/>
<xsl:text>, Not run: </xsl:text>
<xsl:value-of select="@not-run"/>
<xsl:text>, Time: </xsl:text>
<xsl:value-of select="test-suite/@time"/>
<xsl:text> seconds&lt;/b&gt;&lt;br&gt;&lt;br&gt;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='text'/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="test-results">
<xsl:text>&lt;b&gt;</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>&lt;/b&gt;&lt;br&gt;&lt;br&gt;&#xD;&#xA;&#xD;&#xA;</xsl:text>
<xsl:text>&lt;b&gt;NUnit Version:&lt;/b&gt; </xsl:text>
<xsl:value-of select="environment/@nunit-version"/>
<xsl:text>&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;Date:&lt;/b&gt; </xsl:text>
<xsl:value-of select="@date"/>
<xsl:text>&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;Time:&lt;/b&gt; </xsl:text>
<xsl:value-of select="@time"/>
<xsl:text>&lt;br&gt;&lt;br&gt;&#xD;&#xA;&#xD;&#xA;</xsl:text>
<xsl:text>&lt;b&gt;Runtime Environment -&lt;/b&gt;&lt;br&gt;&#xD;&#xA;</xsl:text>
<xsl:text>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;OS Version:&lt;/b&gt; </xsl:text>
<xsl:value-of select="environment/@os-version"/>
<xsl:text>&lt;br&gt;&#xD;&#xA;</xsl:text>
<xsl:text>&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;CLR Version:&lt;/b&gt; </xsl:text>
<xsl:value-of select="environment/@clr-version"/>
<xsl:text>&lt;br&gt;&lt;br&gt;&#xD;&#xA;&#xD;&#xA;</xsl:text>
<xsl:text>&lt;b&gt;Tests run: </xsl:text>
<xsl:value-of select="@total"/>
<xsl:choose>
<xsl:when test ="substring(environment/@nunit-version,1,3)>='2.5'">
<xsl:text>, Errors: </xsl:text>
<xsl:value-of select="@errors"/>
<xsl:text>, Failures: </xsl:text>
<xsl:value-of select="@failures"/>
<xsl:if test="@inconclusive">
<!-- Introduced in 2.5.1 -->
<xsl:text>, Inconclusive: </xsl:text>
<xsl:value-of select="@inconclusive"/>
</xsl:if>
<xsl:text>, Time: </xsl:text>
<xsl:value-of select="test-suite/@time"/>
<xsl:text> seconds&lt;br&gt;</xsl:text>
<xsl:text>&amp;nbsp;&amp;nbsp;&amp;nbsp;Not run: </xsl:text>
<xsl:value-of select="@not-run"/>
<xsl:text>, Invalid: </xsl:text>
<xsl:value-of select="@invalid"/>
<xsl:text>, Ignored: </xsl:text>
<xsl:value-of select="@ignored"/>
<xsl:text>, Skipped: </xsl:text>
<xsl:value-of select="@skipped"/>
<xsl:text>&lt;/b&gt;&lt;br&gt;&lt;br&gt;&#xD;&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>, Failures: </xsl:text>
<xsl:value-of select="@failures"/>
<xsl:text>, Not run: </xsl:text>
<xsl:value-of select="@not-run"/>
<xsl:text>, Time: </xsl:text>
<xsl:value-of select="test-suite/@time"/>
<xsl:text> seconds&lt;/b&gt;&lt;br&gt;&lt;br&gt;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>
</xsl:text>
<xsl:if test="//test-case[failure]">
<xsl:text>&lt;h4&gt;Failures:&lt;/h4&gt;&#xD;&#xA;</xsl:text>
<xsl:text>&lt;ol&gt;&#xD;&#xA;</xsl:text>
<xsl:apply-templates select="//test-case[failure]"/>
<xsl:text>&lt;/ol&gt;&#xD;&#xA;</xsl:text>
</xsl:if>
<xsl:if test="//test-case[@executed='False']">
<xsl:text>&lt;h4&gt;Tests not run:&lt;/h4&gt;&#xD;&#xA;</xsl:text>
<xsl:text>&lt;ol&gt;&#xD;&#xA;</xsl:text>
<xsl:apply-templates select="//test-case[@executed='False']"/>
<xsl:text>&lt;/ol&gt;&#xD;&#xA;</xsl:text>
</xsl:if>
<xsl:text disable-output-escaping='yes'>&#xD;&#xA;</xsl:text>
<xsl:text>&lt;hr&gt;&#xD;&#xA;</xsl:text>
</xsl:template>
<xsl:template match="test-case">
<xsl:text>&lt;pre&gt;&#xD;&#xA;</xsl:text>
<xsl:text>&lt;li&gt;</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> : </xsl:text>
<xsl:value-of select="child::node()/message"/>
<xsl:text disable-output-escaping='yes'>&#xD;&#xA;</xsl:text>
<xsl:if test="failure">
<xsl:value-of select="failure/stack-trace"/>
</xsl:if>
<xsl:text>&lt;/pre&gt;&#xD;&#xA;</xsl:text>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='text'/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:variable name="newline">
<xsl:text>&#xD;&#xA;</xsl:text>
</xsl:variable>
<xsl:variable name="break">
<xsl:text>&#xD;&#xA;&#xD;&#xA;</xsl:text>
</xsl:variable>
<xsl:template match="test-run">
<!-- Runtime Environment -->
<xsl:value-of select="concat('Runtime Environment ', $newline)"/>
<xsl:value-of select="concat(' OS Version: ', test-suite/environment/@os-version[1], $newline)"/>
<xsl:value-of select="concat(' CLR Version: ', @clr-version, $break)"/>
<xsl:value-of select="concat('NUnit Version: ', @engine-version, $break)"/>
<!-- Test Run Summary -->
<xsl:value-of select="concat('Test Run Summary ', $newline)"/>
<xsl:value-of select="concat(' Overall result: ', @result, $newline)"/>
<xsl:value-of select="concat(' Test Count: ', @total, ', Passed: ', @passed, ', Failed: ', @failed, ', Inconclusive: ', @inconclusive, ', Skipped: ', @skipped, $newline)"/>
<!-- [Optional] - Failed Test Summary -->
<xsl:if test="@failed > 0">
<xsl:variable name="failedTotal" select="count(//test-case[@result='Failed' and not(@label)])" />
<xsl:variable name="errorsTotal" select="count(//test-case[@result='Failed' and @label='Error'])" />
<xsl:variable name="invalidTotal" select="count(//test-case[@result='Failed' and @label='Invalid'])" />
<xsl:value-of select="concat(' Failed Tests - Failures: ', $failedTotal, ', Errors: ', $errorsTotal, ', Invalid: ', $invalidTotal, $newline)"/>
</xsl:if>
<!-- [Optional] - Skipped Test Summary -->
<xsl:if test="@skipped > 0">
<xsl:variable name="ignoredTotal" select="count(//test-case[@result='Skipped' and @label='Ignored'])" />
<xsl:variable name="explicitTotal" select="count(//test-case[@result='Skipped' and @label='Explicit'])" />
<xsl:variable name="otherTotal" select="count(//test-case[@result='Skipped' and not(@label='Explicit' or @label='Ignored')])" />
<xsl:value-of select="concat(' Skipped Tests - Ignored: ', $ignoredTotal, ', Explicit: ', $explicitTotal, ', Other: ', $otherTotal, $newline)"/>
</xsl:if>
<!-- Times -->
<xsl:value-of select="concat(' Start time: ', @start-time, $newline)"/>
<xsl:value-of select="concat(' End time: ', @end-time, $newline)"/>
<xsl:value-of select="concat(' Duration: ', format-number(@duration,'0.000'), ' seconds', $break)"/>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:variable name="newline">
<xsl:text>&#xD;&#xA;</xsl:text>
</xsl:variable>
<xsl:variable name="break">
<xsl:text>&#xD;&#xA;&#xD;&#xA;</xsl:text>
</xsl:variable>
<xsl:template match="test-run">
<!-- Command Line -->
<xsl:value-of select="concat('Command Line ', $newline)"/>
<xsl:value-of select="concat(command-line, $break)"/>
<!-- Runtime Environment -->
<xsl:value-of select="concat('Runtime Environment ', $newline)"/>
<xsl:value-of select="concat(' OS Version: ', test-suite/environment/@os-version[1], $newline)"/>
<xsl:value-of select="concat(' CLR Version: ', @clr-version, $break)"/>
<xsl:value-of select="concat('NUnit Version: ', @engine-version, $break)"/>
<!-- Test Files -->
<xsl:value-of select="concat('Test Files ', $newline)"/>
<xsl:for-each select="test-suite[@type='Assembly']">
<xsl:value-of select="concat(' ', @fullname)"/>
<xsl:if test="not(position() = last())">
<xsl:value-of select="$newline"/>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$break"/>
<!-- Tests Not Run -->
<xsl:if test="//test-case[@result='Skipped']">
<xsl:value-of select="concat('Tests Not Run',$break)"/>
</xsl:if>
<xsl:apply-templates select="//test-case[@result='Skipped']"/>
<!-- Errors and Failures -->
<xsl:if test="//test-case[failure]">
<xsl:value-of select="concat('Errors and Failures',$break)"/>
</xsl:if>
<xsl:apply-templates select="//test-case[failure]"/>
<!-- Run Settings (gets first one found) -->
<xsl:variable name="settings" select ="//settings[1]" />
<xsl:value-of select="concat('Run Settings', $newline)"/>
<xsl:value-of select="concat(' ','DefaultTimeout: ', $settings/setting[@name='DefaultTimeout']/@value, $newline)"/>
<xsl:value-of select="concat(' ','WorkDirectory: ', $settings/setting[@name='WorkDirectory']/@value, $newline)"/>
<xsl:value-of select="concat(' ','ImageRuntimeVersion: ', $settings/setting[@name='ImageRuntimeVersion']/@value, $newline)"/>
<xsl:value-of select="concat(' ','ImageTargetFrameworkName: ', $settings/setting[@name='ImageTargetFrameworkName']/@value, $newline)"/>
<xsl:value-of select="concat(' ','ImageRequiresX86: ', $settings/setting[@name='ImageRequiresX86']/@value, $newline)"/>
<xsl:value-of select="concat(' ','ImageRequiresDefaultAppDomainAssemblyResolver: ', $settings/setting[@name='ImageRequiresDefaultAppDomainAssemblyResolver']/@value, $newline)"/>
<xsl:value-of select="concat(' ','NumberOfTestWorkers: ', $settings/setting[@name='NumberOfTestWorkers']/@value)"/>
<xsl:value-of select="$break"/>
<!-- Test Run Summary -->
<xsl:value-of select="concat('Test Run Summary ', $newline)"/>
<xsl:value-of select="concat(' Overall result: ', @result, $newline)"/>
<xsl:value-of select="concat(' Test Count: ', @total, ', Passed: ', @passed, ', Failed: ', @failed, ', Inconclusive: ', @inconclusive, ', Skipped: ', @skipped, $newline)"/>
<!-- [Optional] - Failed Test Summary -->
<xsl:if test="@failed > 0">
<xsl:variable name="failedTotal" select="count(//test-case[@result='Failed' and not(@label)])" />
<xsl:variable name="errorsTotal" select="count(//test-case[@result='Failed' and @label='Error'])" />
<xsl:variable name="invalidTotal" select="count(//test-case[@result='Failed' and @label='Invalid'])" />
<xsl:value-of select="concat(' Failed Tests - Failures: ', $failedTotal, ', Errors: ', $errorsTotal, ', Invalid: ', $invalidTotal, $newline)"/>
</xsl:if>
<!-- [Optional] - Skipped Test Summary -->
<xsl:if test="@skipped > 0">
<xsl:variable name="ignoredTotal" select="count(//test-case[@result='Skipped' and @label='Ignored'])" />
<xsl:variable name="explicitTotal" select="count(//test-case[@result='Skipped' and @label='Explicit'])" />
<xsl:variable name="otherTotal" select="count(//test-case[@result='Skipped' and not(@label='Explicit' or @label='Ignored')])" />
<xsl:value-of select="concat(' Skipped Tests - Ignored: ', $ignoredTotal, ', Explicit: ', $explicitTotal, ', Other: ', $otherTotal, $newline)"/>
</xsl:if>
<!-- Times -->
<xsl:value-of select="concat(' Start time: ', @start-time, $newline)"/>
<xsl:value-of select="concat(' End time: ', @end-time, $newline)"/>
<xsl:value-of select="concat(' Duration: ', format-number(@duration,'0.000'), ' seconds', $break)"/>
</xsl:template>
<xsl:template match="test-case">
<!-- Determine type of test-case for formatting -->
<xsl:variable name="type">
<xsl:choose>
<xsl:when test="@result='Skipped'">
<xsl:choose>
<xsl:when test="@label='Ignored' or @label='Explicit'">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'Other'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@result='Failed'">
<xsl:choose>
<xsl:when test="@label='Error' or @label='Invalid'">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'Failed'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'Unknown'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Show details of test-cases either skipped or errored -->
<xsl:value-of select="concat(position(), ') ', $type,' : ', @fullname, $newline, child::node()/message)"/>
<xsl:choose>
<xsl:when test="$type='Failed'">
<xsl:value-of select="$newline"/>
</xsl:when>
<xsl:when test="$type='Error'">
<xsl:value-of select="$newline"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$break"/>
</xsl:otherwise>
</xsl:choose>
<!-- Stack trace for failures -->
<xsl:if test="failure">
<xsl:choose>
<xsl:when test="$type='Failed'">
<xsl:value-of select="concat(failure/stack-trace,$newline)"/>
</xsl:when>
<xsl:when test="$type='Error'">
<xsl:value-of select="concat(failure/stack-trace,$break)"/>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" encoding="UTF-8" />
<xsl:template match="/">
<style type="text/css">
.strong {
font-weight: bold;
}
.smllabel {
width:110px;
font-weight: bold;
}
td.left {
text-align: left;
}
td.right {
text-align: right;
}
li {
font-family: monospace
}
.collapsed
{
border:0;
border-collapse: collapse;
}
</style>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="test-run">
<!-- Runtime Environment -->
<h4>Runtime Environment</h4>
<table id="runtime">
<tr>
<td class="smllabel right">OS Version:</td>
<td class="left">
<xsl:value-of select="test-suite/environment/@os-version[1]"/>
</td>
</tr>
<tr>
<td class="smllabel right">CLR Version:</td>
<td class="left">
<xsl:value-of select="@clr-version"/>
</td>
</tr>
<tr>
<td colspan="2">
<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
</td>
</tr>
<tr>
<td class="smllabel right">NUnit Version:</td>
<td class="left">
<xsl:value-of select="@engine-version"/>
</td>
</tr>
</table>
<h4>Test Run Summary</h4>
<table id="summary" class="collapsed">
<tr>
<td class="smllabel right">Overall result:</td>
<td class="left">
<xsl:value-of select="@result"/>
</td>
</tr>
<tr>
<td class="smllabel right">Test Count:</td>
<td class="left">
<xsl:value-of select="@total"/>, Passed: <xsl:value-of select="@passed"/>, Failed: <xsl:value-of select="@failed"/>, Inconclusive: <xsl:value-of select="@inconclusive"/>, Skipped: <xsl:value-of select="@skipped"/>
</td>
</tr>
<!-- [Optional] - Failed Test Summary -->
<xsl:if test="@failed > 0">
<xsl:variable name="failedTotal" select="count(//test-case[@result='Failed' and not(@label)])" />
<xsl:variable name="errorsTotal" select="count(//test-case[@result='Failed' and @label='Error'])" />
<xsl:variable name="invalidTotal" select="count(//test-case[@result='Failed' and @label='Invalid'])" />
<tr>
<td class="smllabel right">Failed Tests: </td>
<td class="left">
Failures: <xsl:value-of select="$failedTotal"/>, Errors: <xsl:value-of select="$errorsTotal"/>, Invalid: <xsl:value-of select="$invalidTotal"/>
</td>
</tr>
</xsl:if>
<!-- [Optional] - Skipped Test Summary -->
<xsl:if test="@skipped > 0">
<xsl:variable name="ignoredTotal" select="count(//test-case[@result='Skipped' and @label='Ignored'])" />
<xsl:variable name="explicitTotal" select="count(//test-case[@result='Skipped' and @label='Explicit'])" />
<xsl:variable name="otherTotal" select="count(//test-case[@result='Skipped' and not(@label='Explicit' or @label='Ignored')])" />
<tr>
<td class="smllabel right">Skipped Tests: </td>
<td class="left">
Ignored: <xsl:value-of select="$ignoredTotal"/>, Explicit: <xsl:value-of select="$explicitTotal"/>, Other: <xsl:value-of select="$otherTotal"/>
</td>
</tr>
</xsl:if>
<!-- Times -->
<tr>
<td class="smllabel right">Start time: </td>
<td class="left">
<xsl:value-of select="@start-time"/>
</td>
</tr>
<tr>
<td class="smllabel right">End time: </td>
<td class="left">
<xsl:value-of select="@end-time"/>
</td>
</tr>
<tr>
<td class="smllabel right">Duration: </td>
<td class="left">
<xsl:value-of select="format-number(@duration,'0.000')"/> seconds
</td>
</tr>
</table>
</xsl:template>
</xsl:stylesheet>

Просмотреть файл

@ -0,0 +1,249 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<xsl:template match="/">
<style type="text/css">
.strong {
font-weight: bold;
}
.smllabel {
width:110px;
font-weight: bold;
}
td.left {
text-align: left;
}
td.right {
text-align: right;
}
li {
font-family: monospace
}
.collapsed
{
border:0;
border-collapse: collapse;
}
</style>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="test-run">
<!-- Command Line -->
<h4>Command Line</h4>
<pre>
<xsl:value-of select="command-line"/>
</pre>
<!-- Runtime Environment -->
<h4>Runtime Environment</h4>
<table id="runtime">
<tr>
<td class="smllabel right">OS Version:</td>
<td class="left">
<xsl:value-of select="test-suite/environment/@os-version[1]"/>
</td>
</tr>
<tr>
<td class="smllabel right">CLR Version:</td>
<td class="left">
<xsl:value-of select="@clr-version"/>
</td>
</tr>
<tr>
<td colspan="2">
<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
</td>
</tr>
<tr>
<td class="smllabel right">NUnit Version:</td>
<td class="left">
<xsl:value-of select="@engine-version"/>
</td>
</tr>
</table>
<!-- Test Files -->
<div id="testfiles">
<h4>Test Files</h4>
<xsl:if test="count(test-suite[@type='Assembly']) > 0">
<ol>
<xsl:for-each select="test-suite[@type='Assembly']">
<li>
<xsl:value-of select="@fullname"/>
</li>
</xsl:for-each>
</ol>
</xsl:if>
</div>
<!-- Tests Not Run -->
<xsl:if test="//test-case[@result='Skipped']">
<h4>Tests Not Run</h4>
<ol>
<xsl:apply-templates select="//test-case[@result='Skipped']"/>
</ol>
</xsl:if>
<!-- Errors and Failures -->
<xsl:if test="//test-case[failure]">
<h4>Errors and Failures</h4>
<ol>
<xsl:apply-templates select="//test-case[failure]"/>
</ol>
</xsl:if>
<!-- Run Settings (gets first one found) -->
<xsl:variable name="settings" select ="//settings[1]" />
<h4>Run Settings</h4>
<ul>
<li>
DefaultTimeout: <xsl:value-of select="$settings/setting[@name='DefaultTimeout']/@value"/>
</li>
<li>
WorkDirectory: <xsl:value-of select="$settings/setting[@name='WorkDirectory']/@value"/>
</li>
<li>
ImageRuntimeVersion: <xsl:value-of select="$settings/setting[@name='ImageRuntimeVersion']/@value"/>
</li>
<li>
ImageTargetFrameworkName: <xsl:value-of select="$settings/setting[@name='ImageTargetFrameworkName']/@value"/>
</li>
<li>
ImageRequiresX86: <xsl:value-of select="$settings/setting[@name='ImageRequiresX86']/@value"/>
</li>
<li>
ImageRequiresDefaultAppDomainAssemblyResolver: <xsl:value-of select="$settings/setting[@name='ImageRequiresDefaultAppDomainAssemblyResolver']/@value"/>
</li>
<li>
NumberOfTestWorkers: <xsl:value-of select="$settings/setting[@name='NumberOfTestWorkers']/@value"/>
</li>
</ul>
<h4>Test Run Summary</h4>
<table id="summary" class="collapsed">
<tr>
<td class="smllabel right">Overall result:</td>
<td class="left">
<xsl:value-of select="@result"/>
</td>
</tr>
<tr>
<td class="smllabel right">Test Count:</td>
<td class="left">
<xsl:value-of select="@total"/>, Passed: <xsl:value-of select="@passed"/>, Failed: <xsl:value-of select="@failed"/>, Inconclusive: <xsl:value-of select="@inconclusive"/>, Skipped: <xsl:value-of select="@skipped"/>
</td>
</tr>
<!-- [Optional] - Failed Test Summary -->
<xsl:if test="@failed > 0">
<xsl:variable name="failedTotal" select="count(//test-case[@result='Failed' and not(@label)])" />
<xsl:variable name="errorsTotal" select="count(//test-case[@result='Failed' and @label='Error'])" />
<xsl:variable name="invalidTotal" select="count(//test-case[@result='Failed' and @label='Invalid'])" />
<tr>
<td class="smllabel right">Failed Tests: </td>
<td class="left">
Failures: <xsl:value-of select="$failedTotal"/>, Errors: <xsl:value-of select="$errorsTotal"/>, Invalid: <xsl:value-of select="$invalidTotal"/>
</td>
</tr>
</xsl:if>
<!-- [Optional] - Skipped Test Summary -->
<xsl:if test="@skipped > 0">
<xsl:variable name="ignoredTotal" select="count(//test-case[@result='Skipped' and @label='Ignored'])" />
<xsl:variable name="explicitTotal" select="count(//test-case[@result='Skipped' and @label='Explicit'])" />
<xsl:variable name="otherTotal" select="count(//test-case[@result='Skipped' and not(@label='Explicit' or @label='Ignored')])" />
<tr>
<td class="smllabel right">Skipped Tests: </td>
<td class="left">
Ignored: <xsl:value-of select="$ignoredTotal"/>, Explicit: <xsl:value-of select="$explicitTotal"/>, Other: <xsl:value-of select="$otherTotal"/>
</td>
</tr>
</xsl:if>
<!-- Times -->
<tr>
<td class="smllabel right">Start time: </td>
<td class="left">
<xsl:value-of select="@start-time"/>
</td>
</tr>
<tr>
<td class="smllabel right">End time: </td>
<td class="left">
<xsl:value-of select="@end-time"/>
</td>
</tr>
<tr>
<td class="smllabel right">Duration: </td>
<td class="left">
<xsl:value-of select="format-number(@duration,'0.000')"/> seconds
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="test-case">
<!-- Determine type of test-case for formatting -->
<xsl:variable name="type">
<xsl:choose>
<xsl:when test="@result='Skipped'">
<xsl:choose>
<xsl:when test="@label='Ignored' or @label='Explicit'">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'Other'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@result='Failed'">
<xsl:choose>
<xsl:when test="@label='Error' or @label='Invalid'">
<xsl:value-of select="@label"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'Failed'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'Unknown'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Show details of test-cases either skipped or errored -->
<li>
<pre>
<xsl:value-of select="concat($type,' : ', @fullname)" />
<br/>
<xsl:value-of select="child::node()/message"/>
<xsl:choose>
<xsl:when test="$type='Failed'">
<br/>
</xsl:when>
<xsl:when test="$type='Error'">
<br/>
</xsl:when>
</xsl:choose>
<!-- Stack trace for failures -->
<xsl:if test="failure and ($type='Failed' or $type='Error')">
<xsl:value-of select="failure/stack-trace"/>
</xsl:if>
</pre>
</li>
</xsl:template>
</xsl:stylesheet>