fpcunit.xsl 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method="html" encoding="UTF-8"/>
  4. <xsl:template match="/">
  5. <html>
  6. <head>
  7. <title>fpcUnit Results</title>
  8. <style type="text/css" title="fpcUnit" media="screen">
  9. @import "fpcunit.css";
  10. </style>
  11. <script>
  12. window.onload = function () {
  13. var x = document.getElementsByTagName('div');
  14. for (var i=0;i&lt;x.length;i++)
  15. {
  16. if (x[i].className == 'testsuitelabel')
  17. x[i].onclick = clickSuite;
  18. if (x[i].className == 'testsuiteshowall')
  19. x[i].onclick = openSuites;
  20. if (x[i].className == 'testsuitehideall')
  21. x[i].onclick = closeSuites;
  22. }
  23. closeSuites();
  24. }
  25. function closeSuites()
  26. {
  27. var x = document.getElementsByTagName('div');
  28. for (var i=0;i&lt;x.length;i++)
  29. {
  30. if (x[i].className == 'testcontent')
  31. x[i].style.display = 'none';
  32. }
  33. }
  34. function openSuites()
  35. {
  36. var x = document.getElementsByTagName('div');
  37. for (var i=0;i&lt;x.length;i++)
  38. {
  39. if (x[i].className == 'testcontent')
  40. x[i].style.display = 'block';
  41. }
  42. }
  43. function clickSuite(e)
  44. {
  45. if (!e) var e = window.event;
  46. if (e.target) var tg = e.target;
  47. else if (e.srcElement) var tg = e.srcElement;
  48. while (tg.nodeName != 'DIV') // Safari GRRRRRRRRRR
  49. tg = tg.parentNode;
  50. var nextSib = tg.nextSibling;
  51. while (nextSib.nodeType != 1)
  52. nextSib = nextSib.nextSibling;
  53. var nextSibStatus = (nextSib.style.display == 'none') ? 'block' : 'none';
  54. nextSib.style.display = nextSibStatus;
  55. }
  56. </script>
  57. </head>
  58. <body>
  59. <a name="Summary"/>
  60. <h2>fpcUnit Results</h2>
  61. <xsl:apply-templates/>
  62. <address>
  63. <a href="http://opensoft.homeip.net">fpcUnit Report</a> 0.3.1 © 2006 by
  64. <a href="mailto:[email protected]?subject=Comments about fpcUnit Report">Graeme Geldenhuys</a>.<br/>
  65. Licensed under the <a href="http://www.gnu.org/copyleft/gpl.html">GNU General Public License</a>.<br/>
  66. </address>
  67. </body>
  68. </html>
  69. </xsl:template>
  70. <xsl:template match="TestResults">
  71. <xsl:variable name="runCount" select="NumberOfRunTests"/>
  72. <xsl:variable name="failureCount" select="NumberOfFailures"/>
  73. <xsl:variable name="errorCount" select="NumberOfErrors"/>
  74. <xsl:variable name="elapsedTime" select="TotalElapsedTime"/>
  75. <xsl:variable name="dateRan" select="DateTimeRan"/>
  76. <h3>Summary</h3>
  77. <!-- Summary Table -->
  78. <table border="0" rules="none" width="100%">
  79. <tr align="left" class="title">
  80. <th width="45%" align="left">Name</th>
  81. <th width="7%" align="left">Tests</th>
  82. <th width="8%" align="left">Failures</th>
  83. <th width="8%" align="left">Errors</th>
  84. <th width="11%" align="left">Elapsed Time</th>
  85. <th width="14%" align="left">Run Date</th>
  86. </tr>
  87. <xsl:choose>
  88. <xsl:when test="$errorCount &gt; 0">
  89. <tr class="error">
  90. <td>Summary</td>
  91. <td><xsl:value-of select="$runCount"/></td>
  92. <td><xsl:value-of select="$failureCount"/></td>
  93. <td><xsl:value-of select="$errorCount"/></td>
  94. <td><xsl:value-of select="$elapsedTime"/></td>
  95. <td><xsl:value-of select="$dateRan"/></td>
  96. </tr>
  97. </xsl:when>
  98. <xsl:when test="$failureCount &gt; 0">
  99. <tr class="failure">
  100. <td>Summary</td>
  101. <td><xsl:value-of select="$runCount"/></td>
  102. <td><xsl:value-of select="$failureCount"/></td>
  103. <td><xsl:value-of select="$errorCount"/></td>
  104. <td><xsl:value-of select="$elapsedTime"/></td>
  105. <td><xsl:value-of select="$dateRan"/></td>
  106. </tr>
  107. </xsl:when>
  108. <xsl:otherwise>
  109. <tr class="success">
  110. <td>Summary</td>
  111. <td><xsl:value-of select="$runCount"/></td>
  112. <td><xsl:value-of select="$failureCount"/></td>
  113. <td><xsl:value-of select="$errorCount"/></td>
  114. <td><xsl:value-of select="$elapsedTime"/></td>
  115. <td><xsl:value-of select="$dateRan"/></td>
  116. </tr>
  117. </xsl:otherwise>
  118. </xsl:choose>
  119. </table>
  120. <p>Note: <i>Failures</i> are anticipated and checked for with assertions. <i>Errors</i> are
  121. unexpected results.</p>
  122. <hr/>
  123. <xsl:call-template name="test_listing"/>
  124. <xsl:call-template name="test_failures"/>
  125. <xsl:call-template name="test_errors"/>
  126. </xsl:template>
  127. <xsl:template name="test_listing">
  128. <div id="testlisting">
  129. <a name="Test_Listing"/>
  130. <h3>Test Listing</h3>
  131. <p>
  132. [<a href="#Summary">Summary</a>]
  133. [<a href="#Test_Listing">Test Listing</a>]
  134. [<a href="#Failures">Failures</a>]
  135. [<a href="#Errors">Errors</a>]
  136. </p>
  137. <!-- Test Listing Table -->
  138. <table border="0" rules="none" width="100%">
  139. <tr align="left" class="title">
  140. <td align="left">Name<br/><div class="testsuiteshowall">[show all]</div><div class="testsuitehideall">[hide all]</div></td>
  141. <td width="150" align="right">Elapsed Time<br/>(hh:mm:ss.zzz)</td>
  142. </tr>
  143. </table>
  144. <xsl:for-each select="TestListing/TestSuite">
  145. <div class="testsuitelabel"><xsl:value-of select="@Name"/></div>
  146. <div class="testcontent">
  147. <table border="0" cellspacing="1" width="100%">
  148. <xsl:for-each select="./Test">
  149. <tr class="success">
  150. <td><xsl:value-of select="@Name"/></td>
  151. <td width="150" align="right"><xsl:value-of select="ElapsedTime"/></td>
  152. </tr>
  153. </xsl:for-each> <!-- Test -->
  154. </table>
  155. </div>
  156. </xsl:for-each> <!-- TestSuite -->
  157. </div> <!-- testlisting -->
  158. </xsl:template>
  159. <xsl:template name="test_failures">
  160. <div id="failures">
  161. <a name="Failures"/>
  162. <h3>Failures:</h3>
  163. <p>
  164. [<a href="#Summary">Summary</a>]
  165. [<a href="#Test_Listing">Test Listing</a>]
  166. [<a href="#Failures">Failures</a>]
  167. [<a href="#Errors">Errors</a>]
  168. </p>
  169. <xsl:for-each select="ListOfFailures/Failure">
  170. <p class="backToTop">
  171. [<a href="#Failures">Back to top</a>]
  172. </p>
  173. <table>
  174. <!-- Error Table Body -->
  175. <TR>
  176. <TD valign="top" class="title" width="300">Message:</TD>
  177. <TD valign="top" class="resultmessage"><xsl:value-of select="Message"/></TD>
  178. </TR>
  179. <TR>
  180. <TD valign="top" class="title">Exception Class:</TD>
  181. <TD valign="top" class="resultmessage"><xsl:value-of select="ExceptionClass"/></TD>
  182. </TR>
  183. <TR>
  184. <TD valign="top" class="title">Exception Message:</TD>
  185. <TD valign="top" class="resultmessage"><xsl:value-of select="ExceptionMessage"/></TD>
  186. </TR>
  187. </table>
  188. </xsl:for-each>
  189. </div> <!-- failures -->
  190. </xsl:template>
  191. <xsl:template name="test_errors">
  192. <div id="errors">
  193. <a name="Errors"/>
  194. <h3>Errors</h3>
  195. <p>
  196. [<a href="#Summary">Summary</a>]
  197. [<a href="#Test_Listing">Test Listing</a>]
  198. [<a href="#Failures">Failures</a>]
  199. [<a href="#Errors">Errors</a>]
  200. </p>
  201. <xsl:for-each select="ListOfErrors/Error">
  202. <p class="backToTop">
  203. [<a href="#Errors">Back to top</a>]
  204. </p>
  205. <table>
  206. <!-- Error Table Body -->
  207. <TR>
  208. <TD valign="top" class="title" width="300">Message:</TD>
  209. <TD valign="top" class="resultmessage"><xsl:value-of select="Message"/></TD>
  210. </TR>
  211. <TR>
  212. <TD valign="top" class="title">Exception Class:</TD>
  213. <TD valign="top" class="resultmessage"><xsl:value-of select="ExceptionClass"/></TD>
  214. </TR>
  215. <TR>
  216. <TD valign="top" class="title">Exception Message:</TD>
  217. <TD valign="top" class="resultmessage"><xsl:value-of select="ExceptionMessage"/></TD>
  218. </TR>
  219. <TR>
  220. <TD valign="top" class="title">UnitName:</TD>
  221. <TD valign="top" class="resultmessage"><xsl:value-of select="SourceUnitName"/></TD>
  222. </TR>
  223. <TR>
  224. <TD valign="top" class="title">LineNumber:</TD>
  225. <TD valign="top" class="resultmessage"><xsl:value-of select="LineNumber"/></TD>
  226. </TR>
  227. <TR>
  228. <TD valign="top" class="title">Method Name:</TD>
  229. <TD valign="top" class="resultmessage"><xsl:value-of select="FailedMethodName"/></TD>
  230. </TR>
  231. </table>
  232. </xsl:for-each>
  233. </div> <!-- errors -->
  234. </xsl:template>
  235. </xsl:stylesheet>