/
report.xsl
128 lines (117 loc) · 3.64 KB
/
report.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
NOTE: This file is a working copy only. It is NOT required for the
functioning of utest html export.
-->
<xsl:template match="/">
<html>
<head>
<title>Unit Tests - <xsl:value-of select="suite/application"/> v<xsl:value-of select="suite/version"/></title>
<style type="text/css">
body {
margin: 40px;
}
table {
width:100%;
border-collapse: collapse;
border-color: #bbb;
}
thead {
background-color: #eee;
}
th {
text-align: left;
font-family: Verdana, sans-serif;
font-size: 10pt;
}
td {
text-align: left;
font-family: "Bitstream Vera Sans Mono", Monaco, Courier, monospace;
font-size: 10pt;
font-weight: normal;
}
tr.module {
background-color:#ddd;
border: solid 1px #444;
}
td.pass {
background-color: green;
color: white;
}
td.fail {
background-color: red;
color: white;
}
td.skip {
background-color: orange;
color: white;
}
#tagline {
font-size: 9pt;
text-align: center;
}
</style>
</head>
<body>
<h1><xsl:value-of select="suite/application"/> v<xsl:value-of select="suite/version"/></h1>
<table cellpadding="4" cellspacing="0" border="1">
<thead><tr><th colspan="2">Application</th></tr></thead>
<tbody>
<tr><td>Application</td><td><xsl:value-of select="suite/application" /></td></tr>
<tr><td>Version</td><td><xsl:value-of select="suite/version" /></td></tr>
<tr><td>Status</td><td><xsl:value-of select="suite/status" /></td></tr>
<tr><td>Description</td><td><xsl:value-of select="suite/description" /></td></tr>
<tr><td>Modules</td><td><xsl:value-of select="suite/modules" /></td></tr>
<tr><td>Depends on</td><td><xsl:value-of select="suite/depends" /></td></tr>
</tbody>
</table>
<br/>
<table cellpadding="4" cellspacing="0" border="1">
<thead><tr><th colspan="2">Test Suite</th></tr></thead>
<tbody>
<tr><td>Timestamp</td><td><xsl:value-of select="suite/timestamp" /></td></tr>
<tr><td>Test Host</td><td><xsl:value-of select="suite/host" /></td></tr>
<tr><td>Local Path</td><td><xsl:value-of select="suite/local-path" /></td></tr>
<tr><td>Environment</td><td><xsl:value-of select="suite/env" /></td></tr>
<tr><td>Case Files</td><td><xsl:value-of select="suite/tests" /></td></tr>
</tbody>
</table>
<br/>
<table cellpadding="4" cellspacing="0" border="1">
<thead><tr><th colspan="2">Results</th></tr></thead>
<tbody>
<xsl:for-each select="suite/results/result" >
<tr class="module"><td colspan="2"><b><xsl:value-of select="module" /></b>
- <xsl:value-of select="number" /> tests
- (<em><xsl:value-of select="test-file" />)</em></td></tr>
<xsl:for-each select="test-cases/test-case" >
<tr>
<xsl:choose>
<xsl:when test="output/text() = 'true'">
<td class="pass">PASS</td>
</xsl:when>
<xsl:when test="output/text() = 'false'">
<td class="fail">FAIL</td>
</xsl:when>
<xsl:otherwise>
<td class="skip">SKIP</td>
</xsl:otherwise>
</xsl:choose>
<td><xsl:value-of select="input" /></td>
</tr>
</xsl:for-each>
</xsl:for-each>
</tbody>
</table>
<p id="tagline">Generated by <a href="http://www.github.com/komone/utest">UTEST</a> - Simple Unit Testing for Erlang</p>
</body>
</html>
</xsl:template>
<xsl:template name="ToUpperCase">
<xsl:param name="string"/>
<xsl:value-of select="translate($string,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
</xsl:template>
</xsl:stylesheet>