This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
/
style.xsl
242 lines (201 loc) · 6.61 KB
1
2
3
4
5
6
7
8
9
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Test report</title>
10
11
12
13
14
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"/>
<script type="text/javascript">
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var hideTests = '[Hide tests]';
var showTests = '[Show tests]';
var hideAsserts = '[Hide Assert Summary]';
var showAsserts = '[Show Assert Summary]';
var hideAllTests = '[Hide All Tests]';
var showAllTests = '[Show All Tests]';
var hideEverything = '[Hide Everything]';
var showEverything = '[Show Everything]';
var animationSpeed = 'fast';
29
30
31
32
33
34
$(document).ready(function() {
$("span.show-tests").click(function() {
var content = $(this).html();
var id = $(this).attr('uid');
var searchString = "div.tests[uid="+id+"]";
35
36
37
if(content == hideTests) {
$(searchString).hide(animationSpeed);
$(this).text(showTests);
38
} else {
39
40
$(searchString).show(animationSpeed);
$(this).text(hideTests);
41
42
43
44
45
46
47
48
}
});
$("span.show-asserts").click(function() {
var content = $(this).html();
var id = $(this).attr('uid');
var searchString = "div.asserts[uid="+id+"]";
49
50
51
if(content == hideAsserts) {
$(searchString).hide(animationSpeed);
$(this).text(showAsserts);
52
} else {
53
54
$(searchString).show(animationSpeed);
$(this).text(hideAsserts);
55
56
57
58
59
60
61
}
});
$("span.show-all-tests").click(function() {
var content = $(this).html();
var searchString = "div.tests";
62
63
64
if(content == hideAllTests) {
$(searchString).hide(animationSpeed);
$(this).text(showAllTests);
65
66
/* handle the individual '[show tests]' switcher */
67
$("span.show-tests[uid]").text(showTests);
68
} else {
69
70
$(searchString).show(animationSpeed);
$(this).text(hideAllTests);
71
72
/* handle the individual '[show tests]' switcher */
73
$("span.show-tests[uid]").text(hideTests);
74
75
76
77
78
79
80
}
});
$("span.show-everything").click(function() {
var content = $(this).html();
var searchString = "div.tests";
81
82
83
84
if(content == hideEverything) {
$("div.tests").hide(animationSpeed);
$("div.asserts").hide(animationSpeed);
$(this).text(showEverything);
85
86
/* handle the individual switchers */
87
88
$("span.show-tests[uid]").text(showTests);
$("span.show-asserts[uid]").text(showAsserts);
89
} else {
90
91
92
$("div.tests").show(animationSpeed);
$("div.asserts").show(animationSpeed);
$(this).text(hideEverything);
93
94
/* handle the individual switchers */
95
96
$("span.show-tests[uid]").text(hideTests);
$("span.show-asserts[uid]").text(hideAsserts);
97
98
99
100
101
102
}
});
/* Initially everything is hidden */
$("div.tests").hide();
$("div.asserts").hide();
103
104
/* Color the tests based on the result */
105
106
$("span.testResult[result='passed']").addClass('passed');
$("span.testResult[result='failed']").addClass('failed');
107
$("span.testResult[result='skipped']").addClass('skipped');
108
109
/* Color the asserts based on the result */
110
111
$("span.assertResult[result='pass']").addClass('passed');
$("span.assertResult[result='failure']").addClass('failed');
112
113
114
});
</script>
115
116
<style>
117
div, h1 {
118
padding: 2px 10px 2px 10px;
119
margin: 5px 0px 5px 0px;
120
121
}
122
123
124
125
126
.assert {
padding: 0px 10px 0px 10px;
margin: 0px 0px 0px 0px;
}
127
128
129
.document {
font-family: Arial;
font-size: 11pt;
130
background-color: #EDEDED;
131
132
133
134
135
136
}
.description {
font-style: italic;
}
137
138
139
140
141
.bigtitle {
font-size: 14pt;
font-weight: bold;
}
142
143
144
145
.title {
font-weight: bold;
}
146
147
.switch {
font-style: italic;
148
color: rgb(10, 10, 200);
149
150
151
152
font-size: 10pt;
cursor: pointer;
}
153
.passed {
154
color: green;
155
156
}
157
.failed {
158
color: red;
159
}
160
161
162
163
164
.skipped {
color: gray;
}
165
166
167
168
169
170
171
172
173
174
</style>
</head>
<body class="document">
<h1>Test Report</h1>
<div>
<span class="title">Start time: </span><xsl:value-of select="testlog/startTime"/><br/>
<!-- and ended at <xsl:value-of select="testlog/endTime"/>.<br/>-->
<span class="title">Total runtime: </span><xsl:value-of select="testlog/totalRuntime"/> seconds.<br/>
<span class="title">Harness parameters: </span>
175
176
177
178
179
<span xml:space="preserve">
<xsl:for-each select="testlog/parameters/parameter">
<xsl:value-of select="."/>
</xsl:for-each>
</span>
180
181
182
<br/>
<span class="title">Statistics:</span><br/>
<div class="statistics">
183
<span>Executed </span> <xsl:value-of select="testlog/numSuites"/> test suites. <br/>
184
<span>Tests in total: </span> <xsl:value-of select="testlog/numTests"/> (passed: <xsl:value-of select="testlog/numPassedTests"/>, failed: <xsl:value-of select="testlog/numFailedTests"/>)
185
186
187
</div>
</div>
188
<div>
189
190
191
<br/>
<span class="bigtitle">Test Results</span><br/>
<span class="switch show-all-tests">[Show All Tests] </span> |
192
193
<span class="switch show-everything">[Show Everything]</span>
</div>
194
195
<br/>
196
197
<xsl:for-each select="testlog/suite">
<div id="suite">
198
Suite: <span class="title"> <xsl:value-of select="name"/></span> (<xsl:value-of select="startTime"/>)
199
<div class="suiteInfo">
200
201
Tests: passed <xsl:value-of select="testsPassed"/>, failed <xsl:value-of select="testsFailed"/>, skipped <xsl:value-of select="testsSkipped"/>.<br/>
Total runtime: <xsl:value-of select="totalRuntime"/> seconds. <br/>
202
<span class="show-tests switch" uid="{generate-id(test)}">[Show tests]</span>
203
204
205
<div class="tests" uid="{generate-id(test)}">
<xsl:for-each select="test">
<div class="test">
206
207
Test <span class="title"><xsl:value-of select="name"/>: </span>
<span class="testResult">
208
<xsl:attribute name="result">
209
210
211
212
213
<xsl:value-of select="result"/>
</xsl:attribute><xsl:value-of select="result"/>
</span>
(Total runtime: <xsl:value-of select="totalRuntime"/> seconds)<br/>
Description: <span class="description"> <xsl:value-of select="description"/> </span><br/>
214
215
<span class="switch show-asserts" uid="{generate-id(assertSummary)}">[Show Assert Summary]</span><br/>
<div class="asserts" uid="{generate-id(assertSummary)}">
216
217
<xsl:for-each select="assert">
<div class="assert">
218
219
220
221
222
223
224
225
<xsl:value-of select="name"/>:
<span class="assertResult">
<xsl:attribute name="result">
<xsl:value-of select="result"/>
</xsl:attribute>
<xsl:value-of select="result"/>
</span>.
Message: <span class="description"><xsl:value-of select="message"/></span>
226
227
</div>
</xsl:for-each>
228
Asserts in total: <xsl:value-of select="assertSummary/assertCount"/> (passed: <xsl:value-of select="assertSummary/assertsPassed"/>, failed: <xsl:value-of select="assertSummary/assertsFailed"/>)
229
230
</div>
</div>
231
232
</xsl:for-each>
</div>
233
234
235
236
237
238
239
240
241
</div>
</div>
</xsl:for-each>
<br/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>