check_unittest.xslt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  2. xmlns:c="http://check.sourceforge.net/ns">
  3. <!--
  4. bart@vankuik.nl, 13-MAR-2006
  5. You can use this xslt on the commandline as follows:
  6. $ xsltproc check_unittest.xslt check_output.xml > check_output.html
  7. -->
  8. <xsl:output method="html"/>
  9. <xsl:template match="c:testsuites">
  10. <html><title>Test results</title><body>
  11. <p>
  12. <table width="100%" border="1" cellpadding="0">
  13. <tr><td colspan="7" style='background:#e5E5f5'><h1>Unittests</h1></td></tr>
  14. <xsl:apply-templates/>
  15. </table></p>
  16. </body></html>
  17. </xsl:template>
  18. <xsl:template match="c:suite">
  19. <xsl:apply-templates/>
  20. </xsl:template>
  21. <xsl:template match="c:title">
  22. <tr>
  23. <th colspan="7">Test suite <xsl:apply-templates/></th>
  24. </tr>
  25. <tr>
  26. <td>Path</td>
  27. <td>Filename</td>
  28. <td>Test ID</td>
  29. <td>Iteration</td>
  30. <td>Duration</td>
  31. <td>Description</td>
  32. <td>Message</td>
  33. </tr>
  34. </xsl:template>
  35. <xsl:template match="c:datetime">
  36. <tr><th colspan="7">Test ran at: <xsl:apply-templates/></th></tr>
  37. </xsl:template>
  38. <xsl:template match="c:test[@result='success']">
  39. <tr bgcolor="green"><xsl:apply-templates/></tr>
  40. </xsl:template>
  41. <xsl:template match="c:test[@result='error']">
  42. <tr bgcolor="red"><xsl:apply-templates/></tr>
  43. </xsl:template>
  44. <xsl:template match="c:test[@result='failure']">
  45. <tr bgcolor="red"><xsl:apply-templates/></tr>
  46. </xsl:template>
  47. <xsl:template match="c:path">
  48. <td><xsl:apply-templates/></td>
  49. </xsl:template>
  50. <xsl:template match="c:fn">
  51. <td><xsl:apply-templates/></td>
  52. </xsl:template>
  53. <xsl:template match="c:id">
  54. <td><xsl:apply-templates/></td>
  55. </xsl:template>
  56. <xsl:template match="c:iteration">
  57. <td><xsl:apply-templates/></td>
  58. </xsl:template>
  59. <xsl:template match="c:description">
  60. <td><xsl:apply-templates/></td>
  61. </xsl:template>
  62. <xsl:template match="c:message">
  63. <td><pre><tt><xsl:apply-templates/></tt></pre></td>
  64. </xsl:template>
  65. <xsl:template match="c:test/c:duration">
  66. <td><xsl:apply-templates/></td>
  67. </xsl:template>
  68. <xsl:template match="c:duration">
  69. <tr><th colspan="7">Test duration: <xsl:apply-templates/> seconds</th></tr>
  70. </xsl:template>
  71. </xsl:stylesheet>