Fix the build.
[castle.git] / Samples / MonoRail / MRCCnetDashboard / Dashboard.Web / xsl / MBUnitSummary.xsl
blob7a405d1e31c848725322461fa7730f3aa16cf053
1 <?xml version="1.0"?>
2 <xsl:stylesheet
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
5 <xsl:output method="html"/>
7 <xsl:variable name="nunit2.result.list" select="//report-result/counter"/>
8 <xsl:variable name="nunit2.testcount" select="sum($nunit2.result.list/@run-count)"/>
9 <xsl:variable name="nunit2.failures" select="sum($nunit2.result.list/@failure-count)"/>
10 <xsl:variable name="nunit2.notrun" select="sum($nunit2.result.list/@skip-count)"/>
11 <xsl:variable name="nunit2.time" select="sum($nunit2.result.list/@duration)"/>
12 <xsl:variable name="nunit2.case.list" select="//report-result/assemblies/assembly/namespaces/namespace/fixtures/fixture"/>
13 <xsl:variable name="nunit2.suite.list" select="//report-result/assemblies/assembly/namespaces/namespace/fixtures/fixture/runs/run"/>
14 <xsl:variable name="nunit2.failure.list" select="//report-result/assemblies/assembly/namespaces/namespace/fixtures/fixture/runs/run/exception"/>
15 <xsl:variable name="nunit2.notrun.list" select="$nunit2.case.list//reason"/>
17 <xsl:variable name="testsuite.list" select="/cruisecontrol/build/buildresults//testsuite"/>
18 <xsl:variable name="testcase.list" select="$testsuite.list/testcase"/>
19 <xsl:variable name="testcase.error.list" select="$testcase.list/error"/>
20 <xsl:variable name="testsuite.error.count" select="count($testcase.error.list)"/>
21 <xsl:variable name="testcase.failure.list" select="$testcase.list/failure"/>
22 <!--<xsl:variable name="totalErrorsAndFailures" select="count($testcase.error.list) + count($testcase.failure.list) + count($nunit2.failure.list)"/>-->
23 <xsl:variable name="totalErrorsAndFailures" select="sum($nunit2.result.list/@failure-count)"/>
25 <xsl:template match="/">
26 <table class="section-table" cellpadding="2" cellspacing="0" border="0" width="98%">
28 <!-- Unit Tests -->
29 <tr>
30 <td class="unittests-sectionheader" colspan="2">
31 Tests run: <xsl:value-of select="$nunit2.testcount"/>, Failures: <xsl:value-of select="$nunit2.failures"/>, Not run: <xsl:value-of select="$nunit2.notrun"/>, Time: <xsl:value-of select="$nunit2.time"/> seconds
32 </td>
33 </tr>
35 <xsl:choose>
36 <xsl:when test="$nunit2.testcount = 0">
37 <tr><td colspan="2" class="unittests-data">No Tests Run</td></tr>
38 <tr><td colspan="2" class="unittests-error">This project doesn't have any tests</td></tr>
39 </xsl:when>
41 <xsl:when test="$totalErrorsAndFailures = 0">
42 <tr><td colspan="2" class="unittests-data">All Tests Passed</td></tr>
43 </xsl:when>
44 </xsl:choose>
46 <!--<xsl:apply-templates select="$testcase.error.list"/>
47 <xsl:apply-templates select="$testcase.failure.list | $nunit2.failure.list"/>
48 <xsl:apply-templates select="$nunit2.notrun.list"/>-->
50 <tr><td colspan="2"> </td></tr>
52 <xsl:if test="$totalErrorsAndFailures > 0">
53 <tr>
54 <td class="unittests-sectionheader" colspan="2">
55 Unit Test Failure and Error Details (<xsl:value-of select="$totalErrorsAndFailures"/>)
56 </td>
57 </tr>
59 <!--<xsl:call-template name="nunit2testdetail">
60 <xsl:with-param name="detailnodes" select="$nunit2.suite.list"/>
61 </xsl:call-template>-->
63 <xsl:call-template name="nunit2testdetail">
64 <xsl:with-param name="detailnodes" select="//report-result/assemblies/assembly//namespaces//namespace/fixtures/fixture/runs/run"/>
65 </xsl:call-template>
68 <tr><td colspan="2"> </td></tr>
69 </xsl:if>
71 <xsl:if test="$nunit2.notrun > 0">
72 <tr>
73 <td class="unittests-sectionheader" colspan="2">
74 Warning Details (<xsl:value-of select="$nunit2.notrun"/>)
75 </td>
76 </tr>
77 <!-- (PENDING) Why doesn't this work if set up as variables up top? -->
78 <xsl:call-template name="nunit2testdetail">
79 <xsl:with-param name="detailnodes" select="//test-suite/results/test-case[.//reason]"/>
80 </xsl:call-template>
81 <tr><td colspan="2"> </td></tr>
82 </xsl:if>
83 </table>
84 </xsl:template>
86 <!-- UnitTest Errors -->
87 <xsl:template match="error">
88 <tr>
89 <xsl:if test="position() mod 2 = 0">
90 <xsl:attribute name="class">unittests-oddrow</xsl:attribute>
91 </xsl:if>
92 <td class="unittests-data">Error</td>
93 <td class="unittests-data"><xsl:value-of select="../@name"/></td>
94 </tr>
95 </xsl:template>
97 <!-- UnitTest Failures -->
98 <xsl:template match="failure">
99 <tr>
100 <xsl:if test="($testsuite.error.count + position()) mod 2 = 0">
101 <xsl:attribute name="class">unittests-oddrow</xsl:attribute>
102 </xsl:if>
103 <td class="unittests-data">Failure</td>
104 <td class="unittests-data"><xsl:value-of select="/source"/></td>
105 </tr>
106 </xsl:template>
108 <!-- UnitTest Warnings -->
109 <xsl:template match="reason">
110 <tr>
111 <xsl:if test="($totalErrorsAndFailures + position()) mod 2 = 0">
112 <xsl:attribute name="class">unittests-oddrow</xsl:attribute>
113 </xsl:if>
114 <td class="unittests-data">Warning</td>
115 <td class="unittests-data"><xsl:value-of select="../@name"/></td>
116 </tr>
117 </xsl:template>
119 <!-- UnitTest Errors And Failures Detail Template -->
120 <xsl:template name="testdetail">
121 <xsl:param name="detailnodes"/>
123 <xsl:for-each select="$detailnodes">
125 <xsl:if test="position() > 1">
126 <tr><td colspan="2"><hr size="1" width="100%" color="#888888"/></td></tr>
127 </xsl:if>
129 <tr><td class="unittests-data">Test:</td><td class="unittests-data"><xsl:value-of select="@name"/></td></tr>
131 <xsl:if test="error">
132 <tr><td class="unittests-data">Type:</td><td class="unittests-data"><xsl:value-of select="error/@type"/></td></tr>
133 <tr><td class="unittests-data">Message:</td><td class="unittests-data"><xsl:value-of select="error/@message"/></td></tr>
134 <tr>
135 <td></td>
136 <td class="unittests-error">
137 <pre><xsl:call-template name="br-replace">
138 <xsl:with-param name="word" select="error"/>
139 </xsl:call-template></pre>
140 </td>
141 </tr>
142 </xsl:if>
144 <xsl:if test="failure">
145 <tr><td class="unittests-data">Type:</td><td class="unittests-data"><xsl:value-of select="failure/@type"/></td></tr>
146 <tr><td class="unittests-data">Message:</td><td class="unittests-data"><xsl:value-of select="failure/@message"/></td></tr>
147 <tr>
148 <td></td>
149 <td class="unittests-error">
150 <pre><xsl:call-template name="br-replace">
151 <xsl:with-param name="word" select="failure"/>
152 </xsl:call-template></pre>
153 </td>
154 </tr>
155 </xsl:if>
157 </xsl:for-each>
158 </xsl:template>
160 <!-- UnitTest Errors And Failures Detail Template -->
161 <xsl:template name="nunit2testdetail">
162 <xsl:param name="detailnodes"/>
164 <xsl:for-each select="$detailnodes">
166 <!--<xsl:if test="position() > 1">-->
168 <!--</xsl:if>-->
170 <xsl:if test="exception">
171 <tr><td colspan="2"><hr size="1" width="100%" color="#888888"/></td></tr>
172 <tr><td class="unittests-data">Test:</td><td class="unittests-data"><xsl:value-of select="@name"/></td></tr>
173 <tr><td class="unittests-data">Type:</td><td class="unittests-data">Failure</td></tr>
174 <tr><td class="unittests-data">Message:</td><td class="unittests-data"><xsl:value-of select="exception/message"/></td></tr>
175 <tr>
176 <td></td>
177 <td class="unittests-error">
178 <pre><xsl:value-of select="exception/stack-trace"/></pre>
179 </td>
180 </tr>
181 </xsl:if>
183 <xsl:if test="reason">
184 <tr><td class="unittests-data">Test:</td><td class="unittests-data"><xsl:value-of select="@name"/></td></tr>
185 <tr><td class="unittests-data">Type:</td><td class="unittests-data">Warning</td></tr>
186 <tr><td class="unittests-data">Message:</td><td class="unittests-data"><xsl:value-of select="reason//message"/></td></tr>
187 <tr>
188 <td></td>
189 <td class="unittests-error">
190 <pre><xsl:call-template name="br-replace">
191 <xsl:with-param name="word" select="/stack-trace"/>
192 </xsl:call-template></pre>
193 </td>
194 </tr>
195 </xsl:if>
197 </xsl:for-each>
198 </xsl:template>
200 <!-- UnitTest Errors And Failures Detail Template -->
201 <xsl:template name="nunit2testdetail2">
202 <xsl:param name="detailnodes"/>
204 <xsl:for-each select="$detailnodes">
206 <!--<xsl:if test="position() > 1">-->
208 <!--</xsl:if>-->
210 <xsl:if test="exception">
211 <tr><td colspan="2"><hr size="1" width="100%" color="#888888"/></td></tr>
212 <tr><td class="unittests-data">Test:</td><td class="unittests-data"><xsl:value-of select="@name"/></td></tr>
213 <tr><td class="unittests-data">Type:</td><td class="unittests-data">Failure</td></tr>
214 <tr><td class="unittests-data">Message:</td><td class="unittests-data"><xsl:value-of select="exception/message"/></td></tr>
215 <tr>
216 <td></td>
217 <td class="unittests-error">
218 <pre><xsl:value-of select="exception/stack-trace"/></pre>
219 </td>
220 </tr>
221 </xsl:if>
223 <xsl:if test="reason">
224 <tr><td class="unittests-data">Test:</td><td class="unittests-data"><xsl:value-of select="@name"/></td></tr>
225 <tr><td class="unittests-data">Type:</td><td class="unittests-data">Warning</td></tr>
226 <tr><td class="unittests-data">Message:</td><td class="unittests-data"><xsl:value-of select="reason//message"/></td></tr>
227 <tr>
228 <td></td>
229 <td class="unittests-error">
230 <pre><xsl:call-template name="br-replace">
231 <xsl:with-param name="word" select="/stack-trace"/>
232 </xsl:call-template></pre>
233 </td>
234 </tr>
235 </xsl:if>
237 </xsl:for-each>
238 </xsl:template>
240 <xsl:template name="br-replace">
241 <xsl:param name="word"/>
242 <xsl:variable name="cr"><xsl:text>
243 <!-- </xsl:text> on next line on purpose to get newline -->
244 </xsl:text></xsl:variable>
245 <xsl:choose>
246 <xsl:when test="contains($word,$cr)">
247 <xsl:value-of select="substring-before($word,$cr)"/>
248 <br/>
249 <xsl:call-template name="br-replace">
250 <xsl:with-param name="word" select="substring-after($word,$cr)"/>
251 </xsl:call-template>
252 </xsl:when>
253 <xsl:otherwise>
254 <xsl:value-of select="$word"/>
255 </xsl:otherwise>
256 </xsl:choose>
257 </xsl:template>
259 </xsl:stylesheet>