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%">
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
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>
41 <xsl:when test=
"$totalErrorsAndFailures = 0">
42 <tr><td colspan=
"2" class=
"unittests-data">All Tests Passed
</td></tr>
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">
54 <td class=
"unittests-sectionheader" colspan=
"2">
55 Unit Test Failure and Error Details (
<xsl:value-of select=
"$totalErrorsAndFailures"/>)
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"/>
68 <tr><td colspan=
"2"> </td></tr>
71 <xsl:if test=
"$nunit2.notrun > 0">
73 <td class=
"unittests-sectionheader" colspan=
"2">
74 Warning Details (
<xsl:value-of select=
"$nunit2.notrun"/>)
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]"/>
81 <tr><td colspan=
"2"> </td></tr>
86 <!-- UnitTest Errors -->
87 <xsl:template match=
"error">
89 <xsl:if test=
"position() mod 2 = 0">
90 <xsl:attribute name=
"class">unittests-oddrow
</xsl:attribute>
92 <td class=
"unittests-data">Error
</td>
93 <td class=
"unittests-data"><xsl:value-of select=
"../@name"/></td>
97 <!-- UnitTest Failures -->
98 <xsl:template match=
"failure">
100 <xsl:if test=
"($testsuite.error.count + position()) mod 2 = 0">
101 <xsl:attribute name=
"class">unittests-oddrow
</xsl:attribute>
103 <td class=
"unittests-data">Failure
</td>
104 <td class=
"unittests-data"><xsl:value-of select=
"/source"/></td>
108 <!-- UnitTest Warnings -->
109 <xsl:template match=
"reason">
111 <xsl:if test=
"($totalErrorsAndFailures + position()) mod 2 = 0">
112 <xsl:attribute name=
"class">unittests-oddrow
</xsl:attribute>
114 <td class=
"unittests-data">Warning
</td>
115 <td class=
"unittests-data"><xsl:value-of select=
"../@name"/></td>
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>
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>
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>
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>
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>
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">-->
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>
177 <td class=
"unittests-error">
178 <pre><xsl:value-of select=
"exception/stack-trace"/></pre>
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>
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>
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">-->
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>
217 <td class=
"unittests-error">
218 <pre><xsl:value-of select=
"exception/stack-trace"/></pre>
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>
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>
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>
246 <xsl:when test=
"contains($word,$cr)">
247 <xsl:value-of select=
"substring-before($word,$cr)"/>
249 <xsl:call-template name=
"br-replace">
250 <xsl:with-param name=
"word" select=
"substring-after($word,$cr)"/>
254 <xsl:value-of select=
"$word"/>