Applied patch from Jan Limpens 'ReflectionBasedDictionaryAdapter needs to check if...
[castle.git] / Samples / MonoRail / MRCCnetDashboard / Dashboard.Web / xsl / MBUnitDetails.xsl
blob3c6dd7beae8ab8a2a59a970b9b4b65d15ea9ef90
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3 <!--
4 format a number in to display its value in percent
5 @param value the number to format
6 -->
7 <xsl:template name="display-time-second">
8 <xsl:param name="value"/>
9 <span class="time"><xsl:value-of select="format-number($value,'0.00')"/>s</span>
10 </xsl:template>
12 <!--
13 format a number in to display its value in percent
14 @param value the number to format
15 -->
16 <xsl:template name="display-time">
17 <xsl:param name="value"/>
18 <span class="time"><xsl:value-of select="format-number($value*1000,'0.000')"/>ms</span>
19 </xsl:template>
20 <!--
21 format a number in to display its value in percent
22 @param value the number to format
23 -->
24 <xsl:template name="display-percent">
25 <xsl:param name="value"/>
26 <xsl:value-of select="format-number($value,'0.00 %')"/>
27 </xsl:template>
28 <!--
29 format a number in to display its value in Kb
30 @param value the number to format
31 -->
32 <xsl:template name="display-memory">
33 <xsl:param name="value"/>
34 <xsl:variable name="kbvalue">
35 <xsl:value-of select="$value * 0.0001"/>
36 </xsl:variable>
37 <xsl:value-of select="format-number($kbvalue,'0.00 Kb')"/>
38 </xsl:template>
39 <!--
40 template that will convert a carriage return into a br tag
41 @param word the text from which to convert CR to BR tag
42 -->
43 <xsl:template name="br-replace">
44 <xsl:param name="word"/>
45 <xsl:choose>
46 <xsl:when test="contains($word,'&#xA;')">
47 <xsl:value-of select="substring-before($word,'&#xA;')"/>
48 <br/>
49 <xsl:call-template name="br-replace">
50 <xsl:with-param name="word" select="substring-after($word,'&#xA;')"/>
51 </xsl:call-template>
52 </xsl:when>
53 <xsl:otherwise>
54 <xsl:value-of select="$word"/>
55 </xsl:otherwise>
56 </xsl:choose>
57 </xsl:template>
58 <!--
59 Scales value
60 -->
61 <xsl:template name="scale">
62 <xsl:param name="origLength"/>
63 <xsl:param name="targetLength"/>
64 <xsl:param name="value"/>
65 <xsl:value-of select="($value div $origLength) * $targetLength"/>
66 </xsl:template>
68 <!--
69 Graphical result bar
70 -->
71 <xsl:template name="counter-progressbar">
72 <xsl:param name="width"/>
73 <xsl:param name="height"/>
74 <div>
75 <xsl:attribute name="style">position:relative;background-color:#DDDDDD;border-color:black;width:<xsl:value-of select="$width"/>px;height:<xsl:value-of select="$height"/>px;</xsl:attribute>
76 <!-- success -->
77 <xsl:if test="@success-count > 0">
78 <div>
79 <xsl:attribute name="style">position:absolute;top:0px;left:0px;height:<xsl:value-of select="$height"/>px;background-color:lightgreen;font-size:1px;width:<xsl:call-template name="scale">
80 <xsl:with-param name="origLength" select="@run-count"/>
81 <xsl:with-param name="targetLength" select="$width"/>
82 <xsl:with-param name="value" select="@success-count"/>
83 </xsl:call-template>px;</xsl:attribute>
84 </div>
85 </xsl:if>
86 <!-- failure -->
87 <xsl:if test="@failure-count > 0">
88 <div>
89 <xsl:attribute name="style">position:absolute;top:0px;left:<xsl:call-template name="scale">
90 <xsl:with-param name="origLength" select="@run-count"/>
91 <xsl:with-param name="targetLength" select="$width"/>
92 <xsl:with-param name="value" select="@success-count"/>
93 </xsl:call-template>px;height:<xsl:value-of select="$height"/>px;background-color:red;font-size:1px;width:<xsl:call-template name="scale">
94 <xsl:with-param name="origLength" select="@run-count"/>
95 <xsl:with-param name="targetLength" select="$width"/>
96 <xsl:with-param name="value" select="@failure-count"/>
97 </xsl:call-template>px;</xsl:attribute>
98 </div>
99 </xsl:if>
100 <!-- skip -->
101 <xsl:if test="@skip-count > 0">
102 <div>
103 <xsl:attribute name="style">position:absolute;top:0px;left:<xsl:call-template name="scale">
104 <xsl:with-param name="origLength" select="@run-count"/>
105 <xsl:with-param name="targetLength" select="$width"/>
106 <xsl:with-param name="value" select="@success-count+@failure-count"/>
107 </xsl:call-template>px;height:<xsl:value-of select="$height"/>px;background-color:blueviolet;font-size:1px;width:<xsl:call-template name="scale">
108 <xsl:with-param name="origLength" select="@run-count"/>
109 <xsl:with-param name="targetLength" select="$width"/>
110 <xsl:with-param name="value" select="@skip-count"/>
111 </xsl:call-template>px;</xsl:attribute>
112 </div>
113 </xsl:if>
114 <!-- ignore -->
115 <xsl:if test="@ignore-count > 0">
116 <div>
117 <xsl:attribute name="style">position:absolute;top:0px;left:<xsl:call-template name="scale">
118 <xsl:with-param name="origLength" select="@run-count"/>
119 <xsl:with-param name="targetLength" select="$width"/>
120 <xsl:with-param name="value" select="@success-count+@failure-count+@skip-count"/>
121 </xsl:call-template>px;height:<xsl:value-of select="$height"/>px;background-color:orange;font-size:1px;width:<xsl:call-template name="scale">
122 <xsl:with-param name="origLength" select="@run-count"/>
123 <xsl:with-param name="targetLength" select="$width"/>
124 <xsl:with-param name="value" select="@ignore-count"/>
125 </xsl:call-template>px;</xsl:attribute>
126 </div>
127 </xsl:if>
128 <div>
129 <xsl:attribute name="style">position:absolute;top:0px;left:<xsl:value-of select="$width +2"/>px;height:<xsl:value-of select="$height"/>px;font-size:<xsl:value-of select="$height - 2"/>px;font-family:Verdana;</xsl:attribute><xsl:value-of select="@run-count"/>/<xsl:value-of select="@success-count"/>/<xsl:value-of select="@failure-count"/>/<xsl:value-of select="@skip-count"/>/<xsl:value-of select="@ignore-count"/>/<xsl:value-of select="@assert-count"/></div>
130 </div>
131 </xsl:template>
133 <xsl:template name="counter-literal">
134 <xsl:value-of select="@run-count"/> test,
135 <xsl:value-of select="@success-count"/> success,
136 <xsl:value-of select="@failure-count"/> failures,
137 <xsl:value-of select="@skip-count" /> skipped,
138 <xsl:value-of select="@ignore-count"/> ignored,
139 <xsl:value-of select="@assert-count"/> asserts
140 </xsl:template>
143 <xsl:template name="icon">
144 <xsl:param name="src"/>
145 <img width="16" height="16" border="0">
146 <xsl:attribute name="src"><xsl:value-of select="$src"/></xsl:attribute>
147 </img>
148 </xsl:template>
150 <xsl:template name="assembly-icon">
151 <xsl:call-template name="icon">
152 <xsl:with-param name="src">Populator.png</xsl:with-param>
153 </xsl:call-template>
154 </xsl:template>
156 <xsl:template name="fixture-icon">
157 <xsl:call-template name="icon">
158 <xsl:with-param name="src">Fixture.png</xsl:with-param>
159 </xsl:call-template>
160 </xsl:template>
162 <xsl:template name="namespace-icon">
163 <xsl:call-template name="icon">
164 <xsl:with-param name="src">Category.png</xsl:with-param>
165 </xsl:call-template>
166 </xsl:template>
168 <xsl:template name="run-icon">
169 <xsl:call-template name="icon">
170 <xsl:with-param name="src">Test.png</xsl:with-param>
171 </xsl:call-template>
172 </xsl:template>
174 <xsl:template name="assemblyid">
175 <xsl:param name="name"/>
176 as<xsl:value-of select="$name"/>
177 </xsl:template>
179 <xsl:template name="exceptionid">
180 <xsl:param name="name"/>
181 ex<xsl:value-of select="$name"/>
182 </xsl:template>
184 <!--
185 MbUnit main method.
187 <xsl:template match="/">
188 <div id="mbunit">
189 <script>function ToggleVisible(blockId) {
190 var block = document.all.item(blockId);
191 var plus = document.all.item(blockId + '.plus');
192 if (block.style.display=='none') {
193 block.style.display='block';
194 plus.innerText='- ';
195 } else {
196 block.style.display='none';
197 plus.innerText='+ ';
200 </script>
201 <xsl:apply-templates select="//report-result" />
202 </div>
203 </xsl:template>
205 <xsl:template match="report-result">
206 <table cellpadding="2" cellspacing="0" border="0" width="98%">
207 <tr>
208 <td class="unittests-sectionheader" colspan="3">
209 MbUnit Tests run:
210 <xsl:value-of select="counter/@run-count" /> tests,
211 <xsl:value-of select="counter/@success-count" /> success,
212 <xsl:value-of select="counter/@failure-count" /> failure,
213 <xsl:value-of select="counter/@ignore-count" /> ignored,
214 <xsl:value-of select="counter/@skip-count" /> skipped,
215 <xsl:value-of select="format-number(counter/@duration,'##.##')" /> s
216 </td>
217 </tr>
218 <tr>
219 <td>
220 <xsl:call-template name="report-summary" />
221 <xsl:if test="count(//warnings)>0">
222 <br/>
223 <xsl:call-template name="warnings" />
224 </xsl:if>
225 <br/>
226 <xsl:call-template name="assemblies" />
227 </td>
228 </tr>
229 </table>
230 </xsl:template>
232 <xsl:template name="report-summary">
233 <table border="0" cellpadding="1" cellspacing="1">
234 <tr class="titles">
235 <td>Total</td>
236 <td>
237 <xsl:for-each select="counter">
238 <xsl:call-template name="counter-progressbar">
239 <xsl:with-param name="width">100</xsl:with-param>
240 <xsl:with-param name="height">14</xsl:with-param>
241 </xsl:call-template>
242 </xsl:for-each>
243 </td>
244 </tr>
245 <xsl:call-template name="assembly-summary"/>
246 </table>
247 </xsl:template>
249 <xsl:template name="assembly-summary">
250 <xsl:for-each select="//assemblies/assembly">
251 <tr class="titles">
252 <td>
254 <xsl:attribute name="href">#<xsl:value-of select="@name"/>Assembly</xsl:attribute>
255 <xsl:call-template name="assembly-icon"/>
256 <xsl:value-of select="@name"/>
257 </a>
258 </td>
259 <td>
260 <xsl:for-each select="counter">
261 <xsl:call-template name="counter-progressbar">
262 <xsl:with-param name="width">100</xsl:with-param>
263 <xsl:with-param name="height">12</xsl:with-param>
264 </xsl:call-template>
265 </xsl:for-each>
266 </td>
267 </tr>
268 <xsl:call-template name="fixture-summary" />
269 </xsl:for-each>
270 </xsl:template>
272 <xsl:template name="fixture-id"><xsl:param name="name" /><xsl:value-of select="$name" /></xsl:template>
274 <xsl:template name="fixture-summary">
275 <xsl:for-each select="descendant::fixture">
276 <tr class="fixtureSummary">
277 <td>
279 <xsl:attribute name="href">#<xsl:call-template name="fixture-id"><xsl:with-param name="name">
280 <xsl:value-of select="@type" />.<xsl:value-of select="@name" />
281 </xsl:with-param></xsl:call-template>
282 </xsl:attribute>
283 <xsl:call-template name="fixture-icon"/>
284 <xsl:value-of select="@type" />.<xsl:value-of select="@name" />
285 </a>
286 </td>
287 <td>
288 <xsl:for-each select="counter">
289 <xsl:call-template name="counter-progressbar">
290 <xsl:with-param name="width">100</xsl:with-param>
291 <xsl:with-param name="height">10</xsl:with-param>
292 </xsl:call-template>
293 </xsl:for-each>
294 </td>
295 </tr>
296 </xsl:for-each>
297 </xsl:template>
299 <xsl:template name="warnings">
300 <table>
301 <xsl:for-each select="//warning">
302 <tr>
303 <xsl:attribute name="class">
304 <xsl:choose>
305 <xsl:when test="position() mod 2 = 1">failureOdd</xsl:when>
306 <xsl:otherwise>failureEven</xsl:otherwise>
307 </xsl:choose>
308 </xsl:attribute>
309 <td><xsl:call-template name="run-icon"/>
310 <xsl:value-of select="ancestor::run/@name" /></td>
311 <td><xsl:value-of select="text()"/></td>
312 </tr>
313 </xsl:for-each>
314 </table>
315 </xsl:template>
317 <xsl:template name="assemblies">
318 <xsl:for-each select="assemblies/assembly">
319 <xsl:call-template name="assembly-detail" />
320 </xsl:for-each>
321 </xsl:template>
323 <xsl:template name="assembly-detail">
324 <h2><xsl:attribute name="id"><xsl:value-of select="@name"/>Assembly</xsl:attribute>
325 <xsl:call-template name="assembly-icon"/>
326 <xsl:value-of select="@name"/>
327 </h2>
328 <ul>
329 <li><strong>Full Name:</strong> <xsl:value-of select="@full-name"/></li>
330 <li><strong>Results:</strong>
331 <xsl:for-each select="counter">
332 <xsl:call-template name="counter-literal"/>
333 </xsl:for-each>
334 </li>
335 <li><strong>Duration:</strong>
336 <xsl:call-template name="display-time-second">
337 <xsl:with-param name="value" select="counter/@duration"/>
338 </xsl:call-template>
339 </li>
340 </ul>
341 <xsl:if test="set-up|tear-down">
342 <table>
343 <tr class="assemblysetupteardown" ><td>Assembly SetUp and TearDown</td></tr>
344 <xsl:apply-templates select="set-up"/>
345 <xsl:apply-templates select="tear-down"/>
346 </table>
347 </xsl:if>
348 <xsl:call-template name="namespaces-table" />
349 </xsl:template>
351 <xsl:template name="namespaces-table">
352 <xsl:apply-templates select="namespaces" />
353 <xsl:apply-templates select="namespace" />
354 </xsl:template>
356 <xsl:template match="namespaces">
357 <xsl:apply-templates select="namespace" />
358 </xsl:template>
360 <xsl:template match="namespace">
361 <xsl:apply-templates select="namespaces" />
362 <xsl:apply-templates select="fixtures" />
363 </xsl:template>
365 <xsl:template match="fixtures">
366 <table width="800" border="0" cellpadding="1" cellspacing="1">
367 <col width="700"/>
368 <col width="50"/>
369 <col width="50"/>
370 <xsl:apply-templates select="fixture" />
371 </table>
372 </xsl:template>
374 <xsl:template match="fixture">
375 <tr>
376 <xsl:attribute name="id"><xsl:call-template name="fixture-id"><xsl:with-param name="name">
377 <xsl:value-of select="@type" />.<xsl:value-of select="@name" />
378 </xsl:with-param></xsl:call-template>
379 </xsl:attribute>
380 <td>
381 <xsl:for-each select="counter">
382 <xsl:call-template name="counter-progressbar">
383 <xsl:with-param name="width" select="100" />
384 <xsl:with-param name="height" select="10" />
385 </xsl:call-template>
386 </xsl:for-each>
387 </td>
388 </tr>
389 <tr class="fixture" >
390 <td>
391 <xsl:call-template name="fixture-icon"/>
392 <xsl:value-of select="@type" />.<xsl:value-of select="@name"/>
394 (<xsl:call-template name="display-time-second">
395 <xsl:with-param name="value" select="counter/@duration"/>
396 </xsl:call-template>)
397 </td>
398 </tr>
399 <xsl:if test="set-up|tear-down">
400 <tr class="fixturesetupteardown"><td>Fixture SetUp and TearDown</td></tr>
401 <xsl:apply-templates select="set-up"/>
402 <xsl:apply-templates select="tear-down"/>
403 </xsl:if>
404 <tr>
405 <td>
406 <xsl:apply-templates select="runs" />
407 </td>
408 </tr>
409 </xsl:template>
410 <xsl:template match="runs">
411 <table width="100%" border="0" cellpadding="1" cellspacing="1">
412 <xsl:apply-templates select="*" />
413 </table>
414 </xsl:template>
416 <xsl:template match="set-up">
417 <xsl:call-template name="set-up-or-tear-down" />
418 </xsl:template>
419 <xsl:template match="tear-down">
420 <xsl:call-template name="set-up-or-tear-down" />
421 </xsl:template>
422 <xsl:template name="set-up-or-tear-down">
423 <tr>
424 <!-- Choosing style and alternate -->
425 <xsl:attribute name="class">
426 <xsl:choose>
427 <xsl:when test="@result = 'success'">successEven</xsl:when>
428 <xsl:when test="@result = 'failure'">failureEven</xsl:when>
429 </xsl:choose>
430 </xsl:attribute>
431 <td>
432 <xsl:value-of select="@name"/>
433 </td>
434 <td>
435 <xsl:call-template name="display-time">
436 <xsl:with-param name="value" select="@duration"/>
437 </xsl:call-template>
438 </td>
439 <td>
440 <xsl:call-template name="display-memory">
441 <xsl:with-param name="value" select="@memory"/>
442 </xsl:call-template>
443 </td>
444 </tr>
445 <!-- Adding execption log -->
446 <xsl:if test="@result = 'failure'">
447 <xsl:call-template name="exception-log"/>
448 </xsl:if>
449 <!-- Adding console out, error -->
450 <xsl:call-template name="console-output" />
451 </xsl:template>
453 <!--
455 Run template
458 <xsl:template match="run">
459 <tr>
460 <!-- Choosing style and alternate -->
461 <xsl:attribute name="class">
462 <xsl:choose>
463 <xsl:when test="@result = 'success'">
464 <xsl:choose>
465 <xsl:when test="position() mod 2 = 1">successOdd</xsl:when>
466 <xsl:otherwise>successEven</xsl:otherwise>
467 </xsl:choose>
468 </xsl:when>
469 <xsl:when test="@result = 'failure'">
470 <xsl:choose>
471 <xsl:when test="position() mod 2 = 1">failureOdd</xsl:when>
472 <xsl:otherwise>failureEven</xsl:otherwise>
473 </xsl:choose>
474 </xsl:when>
475 <xsl:when test="@result = 'skip'">
476 <xsl:choose>
477 <xsl:when test="position() mod 2 = 1">skippedOdd</xsl:when>
478 <xsl:otherwise>skippedEven</xsl:otherwise>
479 </xsl:choose>
480 </xsl:when>
481 <xsl:when test="@result = 'ignore'">
482 <xsl:choose>
483 <xsl:when test="position() mod 2 = 1">ignoreOdd</xsl:when>
484 <xsl:otherwise>ignoreEvent</xsl:otherwise>
485 </xsl:choose>
486 </xsl:when>
487 </xsl:choose>
488 </xsl:attribute>
489 <td>
490 <xsl:call-template name="run-icon"/>
491 <xsl:value-of select="@name"/>
492 </td>
493 <td>
494 <xsl:call-template name="display-time">
495 <xsl:with-param name="value" select="@duration"/>
496 </xsl:call-template>
497 </td>
498 <td>
499 <xsl:call-template name="display-memory">
500 <xsl:with-param name="value" select="@memory"/>
501 </xsl:call-template>, <xsl:value-of select="@assert-count" />
502 </td>
503 </tr>
504 <!-- Adding execption log -->
505 <xsl:if test="@result = 'failure'">
506 <xsl:call-template name="exception-log"/>
507 </xsl:if>
508 <!-- Adding console out, error -->
509 <xsl:call-template name="console-output" />
510 </xsl:template>
511 <xsl:template name="exception-log">
512 <tr class="failure-exception">
513 <td>
515 <div style="display;">
516 <table border="0" cellpadding="1" cellspacing="1" width="600">
517 <xsl:apply-templates select="exception" />
518 </table>
519 </div>
520 </td>
521 </tr>
522 </xsl:template>
523 <xsl:template match="exception">
524 <tr class="exceptionType">
525 <td>
526 <strong>Type:</strong>
527 <xsl:value-of select="@type"/>
528 </td>
529 </tr>
530 <tr>
531 <td>
532 <strong>Message:</strong>
533 <xsl:value-of select="message"/>
534 </td>
535 </tr>
536 <tr>
537 <td>
538 <strong>Source:</strong>
539 <xsl:value-of select="source"/>
540 </td>
541 </tr>
542 <xsl:for-each select="properties/property">
543 <tr>
544 <td>
545 <bold><xsl:value-of select="@name"/>:</bold>
546 <xsl:value-of select="@value"/>
547 </td>
548 </tr>
549 </xsl:for-each>
550 <tr>
551 <td width="80">
552 <strong>StackTrace:</strong>
553 <br/>
554 <pre class="stackTrace" width="80">
555 <xsl:value-of select="stack-trace"/>
556 </pre>
557 </td>
558 </tr>
559 <xsl:apply-templates select="exception" />
560 </xsl:template>
561 <xsl:template name="console-output">
562 <xsl:apply-templates select="console-out"/>
563 <xsl:apply-templates select="console-error"/>
564 </xsl:template>
565 <xsl:template match="console-out">
566 <xsl:call-template name="console">
567 <xsl:with-param name="name">Console Output</xsl:with-param>
568 </xsl:call-template>
569 </xsl:template>
570 <xsl:template match="console-error">
571 <xsl:call-template name="console">
572 <xsl:with-param name="name">Console Error</xsl:with-param>
573 </xsl:call-template>
574 </xsl:template>
575 <xsl:template name="console">
576 <xsl:param name="name" />
577 <xsl:if test="string-length( text() ) != 0">
578 <tr>
579 <td>
580 <table>
581 <tr><td><strong><xsl:value-of select="$name"/></strong></td></tr>
582 <tr>
583 <td>
584 <pre class="console"><xsl:value-of select="text()"/></pre>
585 </td>
586 </tr>
587 </table>
588 </td>
589 </tr>
590 </xsl:if>
591 </xsl:template>
592 </xsl:stylesheet>