1 <?xml version=
"1.0" standalone=
"yes"?>
4 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
5 xmlns=
"http://www.w3.org/TR/html4/strict.dtd"
6 exclude-result-prefixes=
""
9 <xsl:output method=
"html"
13 doctype-public=
"-//W3C//DTD HTML 4.01//EN"
14 doctype-system=
"http://www.w3.org/TR/html4/strict.dtd"
18 <xsl:template match=
"/">
20 <script type=
"text/javascript">
21 function toggleDiv(imgId, divId)
23 eDiv = document.getElementById(divId);
24 eImg = document.getElementById(imgId);
26 if ( eDiv.style.display ==
"none" )
28 eDiv.style.
display=
"block";
29 eImg.
src=
"images/arrow_minus_small.gif";
33 eDiv.style.display =
"none";
34 eImg.
src=
"images/arrow_plus_small.gif";
38 function toggleTr(imgId, trId)
40 eTr = document.getElementById(trId);
41 eImg = document.getElementById(imgId);
43 if ( eTr.style.display ==
"none" )
45 /* Setting a TR to display:block doesn't work in proper browsers
46 but IE6's dodgy CSS implementation doesn't know table-row so
47 we need to try...catch it */
50 eTr.style.
display=
"table-row";
54 eTr.style.
display=
"block";
56 eImg.
src=
"images/arrow_minus_small.gif";
60 eTr.style.display =
"none";
61 eImg.
src=
"images/arrow_plus_small.gif";
66 <style type=
"text/css">
67 #master { font: small Verdana }
68 #master table { border-collapse:collapse; table-layout: fixed;}
69 #master tr { height:
25px; vertical-align: middle; }
70 #master th { text-align: center; border-bottom:
1px solid black; border-top:
1px solid black;}
71 #master div { box-sizing: content-box; -moz-box-sizing: content-box; }
72 #master img { display: inline-block; vertical-align: middle; }
74 .col1 { width:
100%; overflow: hidden; min-width:
190px;}
75 .col2 { width:
350px; min-width:
170px; }
76 .col3 { width:
60px; text-align: center; min-width:
40px; max-width:
40px; }
78 th.col2 { border-right:
1px solid black; border-left:
1px solid black; -moz-box-sizing: content-box;}
79 td.col2 div { margin:
0px; padding:
0px; float: left; height:
15px; }
81 .testAssembly { border:
2px solid black; padding:
5px
2px
5px
2px; margin-bottom:
10px; min-width:
400px}
82 .testAssembly table { width:
100%; min-width:
400px; }
84 .testAssembly .testTable { margin:
0 auto; left:
25px; width:
95%; border:
1px solid gray;}
85 .testTable td { border:
1px solid gray; overflow: hidden; padding:
2px
5px
2px
5px; background-color: inherit;}
86 .testName { width:
40%; white-space: nowrap;}
87 .testMsg { width:
60%; }
88 .testMsg div { overflow: auto; width:
100%;}
90 tr.succeeded { background-color: rgb(
145,
222,
121);}
91 tr.failed { background-color: rgb(
245,
147,
147);}
92 tr.ignored { background-color: rgb(
252,
242,
80);}
93 tr.unknown { background-color: gray;}
95 div.succeeded { border:
1px solid green; background-color: rgb(
59,
216,
23);}
96 div.failed { border:
1px solid rgb(
177,
26,
26); background-color: rgb(
228,
95,
95);}
97 div.ignored { border:
1px solid rgb(
233,
221,
26); background-color: yellow;}
98 div.unknown { border:
1px solid black; background-color: gray;}
100 .category { padding-left:
21px; font-style: oblique; font-size: smaller;}
101 .clickable { cursor: pointer; }
103 <xsl:for-each select=
"//test-results[test-suite]">
104 <xsl:variable name=
"divId">
105 <xsl:value-of select=
"generate-id(test-suite/@name)" />
107 <div style=
"margin-bottom: 5px;">
108 <xsl:attribute name=
"onclick">
109 <xsl:text>toggleDiv('img-
</xsl:text>
110 <xsl:value-of select=
"$divId" />
111 <xsl:text>','
</xsl:text>
112 <xsl:value-of select=
"$divId" />
113 <xsl:text>')
</xsl:text>
115 <xsl:attribute name=
"class">
116 <xsl:text>clickable
</xsl:text>
119 <img src=
"images/arrow_minus_small.gif" alt=
"Toggle display of Tests contained within this assembly">
120 <xsl:attribute name=
"id">
121 <xsl:text>img-
</xsl:text>
122 <xsl:value-of select=
"$divId" />
125 <xsl:text> </xsl:text>
127 <xsl:call-template name=
"getSuiteName">
128 <xsl:with-param name=
"name" select=
"test-suite/@name" />
131 <xsl:text> -
 </xsl:text>
132 <xsl:value-of select=
"@total + @not-run"/>
133 <xsl:text> tests
 (
</xsl:text>
134 <xsl:value-of select=
"@total - @failures" />
135 <xsl:text> passed,
 </xsl:text>
136 <xsl:value-of select=
"@failures" />
137 <xsl:text> failed,
 </xsl:text>
138 <xsl:value-of select=
"@not-run" />
139 <xsl:text> didn't run)
</xsl:text>
141 <div class=
"testAssembly">
142 <xsl:attribute name=
"id">
143 <xsl:value-of select=
"$divId" />
147 <th class=
"col1">Test Fixture
</th>
148 <th class=
"col2">Results
</th>
149 <th class=
"col3">Passes
</th>
151 <xsl:for-each select=
".//test-suite[results/test-case]">
152 <xsl:sort select=
"@name" order=
"ascending" data-type=
"text" />
153 <xsl:variable name=
"testsId">
154 <xsl:value-of select=
"generate-id(results/test-case/@name)" />
159 <xsl:attribute name=
"onclick">
160 <xsl:text>toggleTr('img-
</xsl:text>
161 <xsl:value-of select=
"$testsId" />
162 <xsl:text>','
</xsl:text>
163 <xsl:value-of select=
"$testsId" />
164 <xsl:text>')
</xsl:text>
166 <xsl:attribute name=
"class">
167 <xsl:text>clickable
</xsl:text>
170 <img src=
"images/arrow_plus_small.gif" alt=
"Toggle display of the tests within this text fixture">
171 <xsl:attribute name=
"id">
172 <xsl:text>img-
</xsl:text>
173 <xsl:value-of select=
"$testsId" />
176 <xsl:value-of select=
"@name"/>
180 <xsl:apply-templates select=
"." mode=
"graph"/>
183 <xsl:call-template name=
"GetTests">
184 <xsl:with-param name=
"CurrentSuite" select=
"." />
189 <xsl:attribute name=
"id">
190 <xsl:value-of select=
"$testsId" />
192 <xsl:attribute name=
"style">
193 <xsl:text>display:none;
</xsl:text>
196 <xsl:apply-templates select=
"." mode=
"tests" />
206 <!-- Template for a particular TestFixture -->
207 <xsl:template match=
"test-suite[results/test-case]" mode=
"tests">
208 <table class=
"testTable">
209 <xsl:for-each select=
"results/test-case[@success='False']">
210 <xsl:sort select=
"@name" order=
"ascending" data-type=
"text"/>
211 <xsl:apply-templates select=
"." mode=
"test" />
213 <xsl:for-each select=
"results/test-case[@executed='False']">
214 <xsl:sort select=
"@name" order=
"ascending" data-type=
"text"/>
215 <xsl:apply-templates select=
"." mode=
"test" />
217 <xsl:for-each select=
"results/test-case[@success='True']">
218 <xsl:sort select=
"@name" order=
"ascending" data-type=
"text"/>
219 <xsl:apply-templates select=
"." mode=
"test" />
224 <!-- Writes a line in the table for a particular test -->
225 <xsl:template match=
"results/test-case" mode=
"test">
227 <xsl:attribute name=
"class">
228 <xsl:call-template name=
"GetClass">
229 <xsl:with-param name=
"Executed" select=
"@executed" />
230 <xsl:with-param name=
"Succeeded" select=
"@success" />
234 <td class=
"testName">
235 <xsl:call-template name=
"GetImage">
236 <xsl:with-param name=
"Executed" select=
"@executed" />
237 <xsl:with-param name=
"Succeeded" select=
"@success" />
239 <xsl:text> </xsl:text>
240 <xsl:call-template name=
"GetTestName">
241 <xsl:with-param name=
"Name" select=
"@name"/>
243 <xsl:if test=
"categories">
244 <xsl:for-each select=
"categories/category">
245 <div class=
"category">
246 <xsl:text>[
</xsl:text>
247 <xsl:value-of select=
"@name"/>
248 <xsl:text>]
</xsl:text>
254 <xsl:value-of select=
".//message" />
255 <xsl:if test=
".//stack-trace">
257 <div style=
"margin-top: 5px;">
258 <xsl:value-of select=
".//stack-trace" />
265 <!-- Gets the class to use depending upon whether the test passed or failed -->
266 <xsl:template name=
"GetClass">
267 <xsl:param name=
"Executed" />
268 <xsl:param name=
"Succeeded" />
270 <xsl:when test=
"$Executed='False'">
271 <xsl:text>ignored
</xsl:text>
273 <xsl:when test=
"$Executed='True' and $Succeeded='False'">
274 <xsl:text>failed
</xsl:text>
276 <xsl:when test=
"$Executed='True' and $Succeeded='True'">
277 <xsl:text>succeeded
</xsl:text>
280 <xsl:text>unknown
</xsl:text>
285 <!-- Gets the image tag to show success or failure -->
286 <xsl:template name=
"GetImage">
287 <xsl:param name=
"Executed" />
288 <xsl:param name=
"Succeeded" />
291 <xsl:when test=
"$Executed='False'">
292 <img src=
"images/fxcop-error.gif" alt=
"The test wasn't run" width=
"16" height=
"16" />
294 <xsl:when test=
"$Executed='True' and $Succeeded='False'">
295 <img src=
"images/fxcop-critical-error.gif" alt=
"The test failed" width=
"16" height=
"16"/>
297 <xsl:when test=
"$Executed='True' and $Succeeded='True'">
298 <img src=
"images/check.jpg" alt=
"The test suceeded" width=
"16" height=
"16"/>
303 <!-- Template to draw a graph for a particular TestFixture -->
304 <xsl:template match=
"test-suite[results/test-case]" mode=
"graph">
305 <xsl:variable name=
"numTests">
306 <xsl:call-template name=
"GetNumberOfTests">
307 <xsl:with-param name=
"CurrentSuite" select=
"." />
310 <xsl:for-each select=
"results/test-case">
311 <xsl:sort select=
"@executed" order=
"descending" data-type=
"text"/>
312 <xsl:sort select=
"@success" order=
"descending" data-type=
"text" />
314 <xsl:attribute name=
"style">
315 <xsl:text>width:
</xsl:text>
316 <xsl:value-of select=
"(350 - ($numTests * 2)) div $numTests"/>
317 <xsl:text>px;
</xsl:text>
319 <xsl:attribute name=
"class">
320 <xsl:call-template name=
"GetClass">
321 <xsl:with-param name=
"Executed" select=
"@executed"/>
322 <xsl:with-param name=
"Succeeded" select=
"@success"/>
325 <xsl:text> </xsl:text>
330 <!-- Calculates the total number of tests in a particular testfixture -->
331 <xsl:template name=
"GetNumberOfTests">
332 <xsl:param name=
"CurrentSuite" />
333 <xsl:value-of select=
"count($CurrentSuite/results/test-case)"/>
336 <!-- Gets the text for the third column -->
337 <xsl:template name=
"GetTests">
338 <xsl:param name=
"CurrentSuite" />
340 <xsl:text>(
</xsl:text>
341 <xsl:value-of select=
"count($CurrentSuite/results/test-case[@success='True'])"/>
342 <xsl:text>/
</xsl:text>
343 <xsl:value-of select=
"count($CurrentSuite/results/test-case)"/>
344 <xsl:text>)
</xsl:text>
347 <!-- Takes a full path and returns the filename -->
348 <xsl:template name=
"getSuiteName">
349 <xsl:param name=
"name"/>
351 <xsl:when test=
"contains($name, '\')">
352 <xsl:call-template name=
"getSuiteName">
353 <xsl:with-param name=
"name" select=
"substring-after($name, '\')"/>
356 <xsl:when test=
"contains($name, '/')">
357 <xsl:call-template name=
"getSuiteName">
358 <xsl:with-param name=
"name" select=
"substring-after($name, '/')"/>
362 <xsl:value-of select=
"$name"/>
367 <!-- Takes a fully qualified test name and returns just the name of the test -->
368 <xsl:template name=
"GetTestName">
369 <xsl:param name=
"Name"/>
371 <xsl:when test=
"contains($Name, '.')">
372 <xsl:call-template name=
"GetTestName">
373 <xsl:with-param name=
"Name" select=
"substring-after($Name, '.')"/>
377 <xsl:value-of select=
"$Name"/>