Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HtmlTransform-v3.xslt and update HtmlSummary-v3.xslt to make html consistent #10

Merged
merged 3 commits into from
Sep 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Transforms/DefaultTransform-v3.xslt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?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:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
Expand All @@ -14,6 +14,10 @@
</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)"/>
Expand Down
220 changes: 98 additions & 122 deletions src/Transforms/HtmlSummary-v3.xslt
Original file line number Diff line number Diff line change
@@ -1,158 +1,134 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:preserve-space elements="*" />
<xsl:output omit-xml-declaration="yes" method="html" indent="yes" encoding="UTF-8" />
<xsl:output omit-xml-declaration="yes" indent="yes" encoding="UTF-8" />
<xsl:template match="/">
<style type="text/css">
* {
font-family: "Times New Roman", Times, serif;
}

.strong {
font-weight: bold;
}
</style>
<xsl:apply-templates/>

</xsl:template>

<xsl:template match="test-run">

<!-- Runtime Environment -->
<div id="runtime">
<span class="strong">Runtime Environment </span>
.smllabel {
width:110px;
font-weight: bold;
}

<br />
<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]]></xsl:text>
<span class="strong">OS Version: </span>
td.left {
text-align: left;
}

<span>
<xsl:value-of select="test-suite/environment/@os-version[1]"/>
</span>
<br/>
<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;&nbsp;&nbsp;]]></xsl:text>
<span class="strong"> CLR Version: </span>
td.right {
text-align: right;
}

<span>
<xsl:value-of select="@clr-version"/>
</span>
<br/>
<br/>
li {
font-family: monospace
}
.collapsed
{
border:0;
border-collapse: collapse;
}

<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
<span class="strong">
NUnit Version:
</span>
</style>
<xsl:apply-templates/>

<span>
<xsl:value-of select="@engine-version"/>
</span>
<br/>
</div>
<br/>
</xsl:template>

<!-- Test Summary-->
<div id="testsummary">
<span class="strong">Test Run Summary</span>
<br/>
<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
<span class="strong"> Overall result: </span>
<span>
<xsl:value-of select="@result"/>
</span>
<br/>
<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
<xsl:template match="test-run">

<span class="strong"> Test Count: </span>
<span>
<xsl:value-of select="@total"/>,
</span>
<span class="strong"> Passed: </span>
<span>
<xsl:value-of select="@passed"/>,
</span>
<span class="strong"> Failed: </span>
<span>
<xsl:value-of select="@failed"/>,
</span>
<span class="strong"> Inconclusive: </span>
<span>
<xsl:value-of select="@inconclusive"/>,
</span>
<span class="strong"> Skipped: </span>
<span>
<xsl:value-of select="@skipped"/>
</span>
<br/>
<!-- 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'])" />

<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]]></xsl:text>
<span class="strong">Failed Tests - Failures: </span>
<span>
<xsl:value-of select="$failedTotal"/>,
</span>
<span class="strong"> Errors: </span>
<span>
<xsl:value-of select="$errorsTotal"/>,
</span>
<span class="strong"> Invalid: </span>
<span>
<xsl:value-of select="$invalidTotal"/>
</span>
<br/>
<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')])" />

<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]]></xsl:text>
<span class="strong">Skipped Tests - Ignored: </span>
<span>
<xsl:value-of select="$ignoredTotal"/>,
</span>
<span class="strong"> Explicit: </span>
<span>
<xsl:value-of select="$explicitTotal"/>,
</span>
<span class="strong"> Other: </span>
<span>
<xsl:value-of select="$otherTotal"/>
</span>

<br/>
<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 -->
<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;&nbsp;]]></xsl:text>
<span class="strong">Start time: </span>
<span>
<xsl:value-of select="@start-time"/>
</span>
<br/>
<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp]]></xsl:text>
<span class="strong">End time: </span>
<span>
<xsl:value-of select="@end-time"/>
</span>
<br/>
<xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;]]></xsl:text>
<span class="strong">Duration: </span>
<span>
<xsl:value-of select="format-number(@duration,'0.000')"/> seconds
</span>
<br/>
</div>
<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>


<br/>

</xsl:template>

</xsl:stylesheet>
Loading