Added RedirectUsingNamedRoute
[castle.git] / Samples / MonoRail / MRCCnetDashboard / Dashboard.Web / xsl / AlternativeNUnitDetails.xsl
blobaa23661a821e48ebef98dd12b5b166ee7c3114df
1 <?xml version="1.0" standalone="yes"?>
2 <xsl:stylesheet
3 version="1.0"
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"
10 encoding="ISO-8859-1"
11 standalone="yes"
12 version="1.0"
13 doctype-public="-//W3C//DTD HTML 4.01//EN"
14 doctype-system="http://www.w3.org/TR/html4/strict.dtd"
15 indent="yes"/>
18 <xsl:template match="/">
19 <div id="report">
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";
31 else
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 */
48 try
50 eTr.style.display="table-row";
52 catch(e)
54 eTr.style.display="block";
56 eImg.src="images/arrow_minus_small.gif";
58 else
60 eTr.style.display = "none";
61 eImg.src="images/arrow_plus_small.gif";
64 </script>
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; }
102 </style>
103 <xsl:for-each select="//test-results[test-suite]">
104 <xsl:variable name="divId">
105 <xsl:value-of select="generate-id(test-suite/@name)" />
106 </xsl:variable>
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>
114 </xsl:attribute>
115 <xsl:attribute name="class">
116 <xsl:text>clickable</xsl:text>
117 </xsl:attribute>
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" />
123 </xsl:attribute>
124 </img>
125 <xsl:text>&#0160;</xsl:text>
126 <strong>
127 <xsl:call-template name="getSuiteName">
128 <xsl:with-param name="name" select="test-suite/@name" />
129 </xsl:call-template>
130 </strong>
131 <xsl:text>&#0160;-&#0160;</xsl:text>
132 <xsl:value-of select="@total + @not-run"/>
133 <xsl:text>&#0160;tests&#0160;(</xsl:text>
134 <xsl:value-of select="@total - @failures" />
135 <xsl:text>&#0160;passed,&#0160;</xsl:text>
136 <xsl:value-of select="@failures" />
137 <xsl:text>&#0160;failed,&#0160;</xsl:text>
138 <xsl:value-of select="@not-run" />
139 <xsl:text>&#0160;didn't run)</xsl:text>
140 </div>
141 <div class="testAssembly">
142 <xsl:attribute name="id">
143 <xsl:value-of select="$divId" />
144 </xsl:attribute>
145 <table>
146 <tr>
147 <th class="col1">Test Fixture</th>
148 <th class="col2">Results</th>
149 <th class="col3">Passes</th>
150 </tr>
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)" />
155 </xsl:variable>
156 <tr>
157 <td class="col1">
158 <span>
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>
165 </xsl:attribute>
166 <xsl:attribute name="class">
167 <xsl:text>clickable</xsl:text>
168 </xsl:attribute>
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" />
174 </xsl:attribute>
175 </img>
176 <xsl:value-of select="@name"/>
177 </span>
178 </td>
179 <td class="col2">
180 <xsl:apply-templates select="." mode="graph"/>
181 </td>
182 <td class="col3">
183 <xsl:call-template name="GetTests">
184 <xsl:with-param name="CurrentSuite" select="." />
185 </xsl:call-template>
186 </td>
187 </tr>
188 <tr>
189 <xsl:attribute name="id">
190 <xsl:value-of select="$testsId" />
191 </xsl:attribute>
192 <xsl:attribute name="style">
193 <xsl:text>display:none;</xsl:text>
194 </xsl:attribute>
195 <td colspan="3">
196 <xsl:apply-templates select="." mode="tests" />
197 </td>
198 </tr>
199 </xsl:for-each>
200 </table>
201 </div>
202 </xsl:for-each>
203 </div>
204 </xsl:template>
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" />
212 </xsl:for-each>
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" />
216 </xsl:for-each>
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" />
220 </xsl:for-each>
221 </table>
222 </xsl:template>
224 <!-- Writes a line in the table for a particular test -->
225 <xsl:template match="results/test-case" mode="test">
226 <tr>
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" />
231 </xsl:call-template>
232 </xsl:attribute>
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" />
238 </xsl:call-template>
239 <xsl:text>&#0160;</xsl:text>
240 <xsl:call-template name="GetTestName">
241 <xsl:with-param name="Name" select="@name"/>
242 </xsl:call-template>
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>
249 </div>
250 </xsl:for-each>
251 </xsl:if>
252 </td>
253 <td class="testMsg">
254 <xsl:value-of select=".//message" />
255 <xsl:if test=".//stack-trace">
256 <br/>
257 <div style="margin-top: 5px;">
258 <xsl:value-of select=".//stack-trace" />
259 </div>
260 </xsl:if>
261 </td>
262 </tr>
263 </xsl:template>
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" />
269 <xsl:choose>
270 <xsl:when test="$Executed='False'">
271 <xsl:text>ignored</xsl:text>
272 </xsl:when>
273 <xsl:when test="$Executed='True' and $Succeeded='False'">
274 <xsl:text>failed</xsl:text>
275 </xsl:when>
276 <xsl:when test="$Executed='True' and $Succeeded='True'">
277 <xsl:text>succeeded</xsl:text>
278 </xsl:when>
279 <xsl:otherwise>
280 <xsl:text>unknown</xsl:text>
281 </xsl:otherwise>
282 </xsl:choose>
283 </xsl:template>
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" />
290 <xsl:choose>
291 <xsl:when test="$Executed='False'">
292 <img src="images/fxcop-error.gif" alt="The test wasn't run" width="16" height="16" />
293 </xsl:when>
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"/>
296 </xsl:when>
297 <xsl:when test="$Executed='True' and $Succeeded='True'">
298 <img src="images/check.jpg" alt="The test suceeded" width="16" height="16"/>
299 </xsl:when>
300 </xsl:choose>
301 </xsl:template>
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="." />
308 </xsl:call-template>
309 </xsl:variable>
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" />
313 <div>
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>
318 </xsl:attribute>
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"/>
323 </xsl:call-template>
324 </xsl:attribute>
325 <xsl:text>&#0160;</xsl:text>
326 </div>
327 </xsl:for-each>
328 </xsl:template>
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)"/>
334 </xsl:template>
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>
345 </xsl:template>
347 <!-- Takes a full path and returns the filename -->
348 <xsl:template name="getSuiteName">
349 <xsl:param name="name"/>
350 <xsl:choose>
351 <xsl:when test="contains($name, '\')">
352 <xsl:call-template name="getSuiteName">
353 <xsl:with-param name="name" select="substring-after($name, '\')"/>
354 </xsl:call-template>
355 </xsl:when>
356 <xsl:when test="contains($name, '/')">
357 <xsl:call-template name="getSuiteName">
358 <xsl:with-param name="name" select="substring-after($name, '/')"/>
359 </xsl:call-template>
360 </xsl:when>
361 <xsl:otherwise>
362 <xsl:value-of select="$name"/>
363 </xsl:otherwise>
364 </xsl:choose>
365 </xsl:template>
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"/>
370 <xsl:choose>
371 <xsl:when test="contains($Name, '.')">
372 <xsl:call-template name="GetTestName">
373 <xsl:with-param name="Name" select="substring-after($Name, '.')"/>
374 </xsl:call-template>
375 </xsl:when>
376 <xsl:otherwise>
377 <xsl:value-of select="$Name"/>
378 </xsl:otherwise>
379 </xsl:choose>
380 </xsl:template>
381 </xsl:stylesheet>