2 <xsl:stylesheet version=
"1.0" xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform" xmlns=
"http://www.w3.org/TR/html4/strict.dtd">
3 <xsl:output method=
"html"/>
5 <xsl:template match=
"/">
6 <xsl:variable name=
"tests.root" select=
"cruisecontrol//test-results" />
9 function toggleDiv( imgId, divId )
11 eDiv = document.getElementById( divId );
12 eImg = document.getElementById( imgId );
14 if ( eDiv.style.display ==
"none" )
16 eDiv.style.display =
"block";
17 eImg.src =
"images/arrow_minus_small.gif";
21 eDiv.style.display =
"none";
22 eImg.src =
"images/arrow_plus_small.gif";
26 <h1>NUnit Test Results
</h1>
32 <td>Assemblies tested:
</td>
33 <td><xsl:value-of select=
"count($tests.root)"/></td>
36 <td>Tests executed:
</td>
37 <td><xsl:value-of select=
"count($tests.root//test-case[@executed = 'True'])"/></td>
41 <td><xsl:value-of select=
"count($tests.root//test-case[@executed = 'True' and @success = 'True'])"/></td>
45 <td><xsl:value-of select=
"count($tests.root//test-case[@executed = 'True' and @success = 'False'])"/></td>
49 <td><xsl:value-of select=
"count($tests.root//test-case[@executed = 'False'])"/></td>
55 <h3>Assembly Test Details:
</h3>
56 <xsl:apply-templates select=
"$tests.root" />
61 <xsl:template match=
"test-results">
62 <xsl:variable name=
"test.suite.id" select=
"generate-id()" />
63 <xsl:variable name=
"test.suite.name" select=
"./@name"/>
64 <xsl:variable name=
"failure.count" select=
"count(.//results/test-case[@success='False'])" />
65 <xsl:variable name=
"ignored.count" select=
"count(.//results/test-case[@executed='False'])" />
67 <table cellpadding=
"2" cellspacing=
"0" border=
"0" width=
"98%">
69 <td class=
"yellow-sectionheader" colspan=
"3" valign=
"top">
71 <xsl:when test=
"$failure.count > 0">
72 <img src=
"images/fxcop-critical-error.gif">
73 <xsl:attribute name=
"title">Failed tests:
<xsl:value-of select=
"$failure.count" /></xsl:attribute>
76 <xsl:when test=
"$ignored.count > 0">
77 <img src=
"images/fxcop-error.gif">
78 <xsl:attribute name=
"title">Ignored tests:
<xsl:value-of select=
"$ignored.count" /></xsl:attribute>
82 <img src=
"images/check.jpg" width=
"16" height=
"16"/>
86 <input type=
"image" src=
"images/arrow_minus_small.gif">
87 <xsl:attribute name=
"id">img
<xsl:value-of select=
"$test.suite.id"/></xsl:attribute>
88 <xsl:attribute name=
"onclick">javascript:toggleDiv('img
<xsl:value-of select=
"$test.suite.id"/>', 'divDetails
<xsl:value-of select=
"$test.suite.id"/>');
</xsl:attribute>
89 </input> <xsl:value-of select=
"$test.suite.name"/>
94 <xsl:attribute name=
"id">divDetails
<xsl:value-of select=
"$test.suite.id"/></xsl:attribute>
102 <xsl:apply-templates select=
".//test-suite[@success='False'][results/test-case]">
103 <xsl:sort select=
"@name" order=
"ascending" data-type=
"text"/>
104 </xsl:apply-templates>
105 <xsl:apply-templates select=
".//test-suite[results/test-case/@executed='False']">
106 <xsl:sort select=
"@name" order=
"ascending" data-type=
"text"/>
107 </xsl:apply-templates>
108 <xsl:apply-templates select=
".//test-suite[@success='True'][results/test-case/@executed='True']" mode=
"success">
109 <xsl:sort select=
"@name" order=
"ascending" data-type=
"text"/>
110 </xsl:apply-templates>
116 <xsl:template match=
"test-suite" mode=
"success">
117 <xsl:if test=
"count(results/test-case[@success='False']) + count(results/test-case[@executed='False']) = 0">
118 <xsl:apply-templates select=
"."/>
122 <xsl:template match=
"test-suite">
123 <xsl:variable name=
"passedtests.list" select=
"results/test-case[@success='True']"/>
124 <xsl:variable name=
"ignoredtests.list" select=
"results/test-case[@executed='False']"/>
125 <xsl:variable name=
"failedtests.list" select=
"results/test-case[@success='False']"/>
126 <xsl:variable name=
"tests.count" select=
"count(results/test-case)"/>
127 <xsl:variable name=
"passedtests.count" select=
"count($passedtests.list)"/>
128 <xsl:variable name=
"ignoredtests.count" select=
"count($ignoredtests.list)"/>
129 <xsl:variable name=
"failedtests.count" select=
"count($failedtests.list)"/>
131 <xsl:variable name=
"testName" select=
"@name"/>
133 <td valign=
"top" width=
"30%">
134 <input type=
"image" src=
"images/arrow_plus_small.gif">
135 <xsl:attribute name=
"id">imgTestCase_
<xsl:value-of select=
"@name"/></xsl:attribute>
136 <xsl:attribute name=
"onClick">javascript:toggleDiv('imgTestCase_
<xsl:value-of select=
"$testName"/>', 'divTest_
<xsl:value-of select=
"$testName"/>');
</xsl:attribute>
139 <xsl:attribute name=
"name"><xsl:value-of select=
"@name"/></xsl:attribute>
140 <xsl:value-of select=
"@name"/>
144 <table border=
"0" cellspacing=
"1" width=
"100%">
146 <xsl:if test=
"$passedtests.count > 0">
147 <xsl:variable name=
"passedtests.countpercent" select=
"($passedtests.count * 100) div $tests.count"/>
149 <xsl:attribute name=
"width"><xsl:value-of select=
"$passedtests.countpercent"/>%
</xsl:attribute>
153 <xsl:if test=
"$ignoredtests.count > 0">
154 <xsl:variable name=
"ignoredtests.countpercent" select=
"($ignoredtests.count * 100) div $tests.count"/>
155 <td bgcolor=
"yellow">
156 <xsl:attribute name=
"width"><xsl:value-of select=
"$ignoredtests.countpercent"/>%
</xsl:attribute>
160 <xsl:if test=
"$failedtests.count > 0">
161 <xsl:variable name=
"failedtests.countpercent" select=
"($failedtests.count * 100) div $tests.count"/>
163 <xsl:attribute name=
"width"><xsl:value-of select=
"$failedtests.countpercent"/>%
</xsl:attribute>
169 <!--xsl:if test="$failedtests.count > 0 or $ignoredtests.count > 0"-->
170 <div style=
"display:none">
171 <xsl:attribute name=
"id">divTest_
<xsl:value-of select=
"$testName"/></xsl:attribute>
172 <table border=
"0" cell-padding=
"6" cell-spacing=
"0" width=
"100%">
173 <xsl:apply-templates select=
"$failedtests.list"/>
174 <xsl:apply-templates select=
"$ignoredtests.list"/>
175 <xsl:apply-templates select=
"$passedtests.list"/>
181 (
<xsl:value-of select=
"$passedtests.count"/>/
<xsl:value-of select=
"$tests.count"/>)
186 <xsl:template match=
"test-case[@success='True']">
188 <xsl:if test=
"position() mod 2 = 0">
189 <xsl:attribute name=
"class">section-oddrow
</xsl:attribute>
192 <img src=
"images\check.jpg" width=
"16" height=
"16"/>
195 <xsl:call-template name=
"getTestName">
196 <xsl:with-param name=
"name" select=
"@name"/>
200 <xsl:value-of select=
"substring-after(failure/message, '-')"/>
204 <xsl:template match=
"test-case[@success='False']">
206 <xsl:if test=
"position() mod 2 = 0">
207 <xsl:attribute name=
"class">section-oddrow
</xsl:attribute>
210 <img src=
"images\fxcop-critical-error.gif"/>
213 <xsl:call-template name=
"getTestName">
214 <xsl:with-param name=
"name" select=
"@name"/>
217 <td bgcolor=
"gainsboro">
218 <xsl:value-of select=
"substring-after(failure/message, '-')"/><br/>
219 <xsl:value-of select=
"failure/message"/>
224 <xsl:template match=
"test-case[@executed='False']">
226 <xsl:if test=
"position() mod 2 = 0">
227 <xsl:attribute name=
"class">section-oddrow
</xsl:attribute>
230 <img src=
"images\fxcop-error.gif"/>
233 <xsl:call-template name=
"getTestName">
234 <xsl:with-param name=
"name" select=
"@name"/>
238 <xsl:value-of select=
"substring-after(reason/message, '-')"/>
243 <xsl:template name=
"getTestName">
244 <xsl:param name=
"name"/>
246 <xsl:when test=
"contains($name, '.')">
247 <xsl:call-template name=
"getTestName">
248 <xsl:with-param name=
"name" select=
"substring-after($name, '.')"/>
252 <xsl:value-of select=
"$name"/>