This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
/
style.xsl
229 lines (180 loc) · 5.94 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
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
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"/>
<script type="text/javascript">
$(document).ready(function() {
$("span.show-tests").click(function() {
var content = $(this).html();
var id = $(this).attr('uid');
var searchString = "div.tests[uid="+id+"]";
if(content == '[Hide tests]') {
$(searchString).hide("fast");
$(this).text('[Show tests]');
} else {
$(searchString).show("fast");
$(this).text('[Hide tests]');
}
});
$("span.show-asserts").click(function() {
var content = $(this).html();
var id = $(this).attr('uid');
console.log("assert uid" + id);
var searchString = "div.asserts[uid="+id+"]";
if(content == '[Hide Assert Summary]') {
console.log("hide now");
$(searchString).hide("fast");
$(this).text('[Show Assert Summary]');
} else {
console.log("show now");
$(searchString).show("fast");
$(this).text('[Hide Assert Summary]');
}
});
$("span.show-all-tests").click(function() {
var content = $(this).html();
var searchString = "div.tests";
if(content == '[Hide All Tests]') {
console.log("hide now");
$(searchString).hide("fast");
$(this).text('[Show All Tests]');
/* handle the individual '[show tests]' switcher */
$("span.show-tests[uid]").text('[Show tests]');
} else {
console.log("show now");
$(searchString).show("fast");
$(this).text('[Hide All Tests]');
/* handle the individual '[show tests]' switcher */
$("span.show-tests[uid]").text('[Hide tests]');
}
});
$("span.show-everything").click(function() {
var content = $(this).html();
var searchString = "div.tests";
if(content == '[Hide Everything]') {
console.log("hide now");
$("div.tests").hide("fast");
$("div.asserts").hide("fast");
$(this).text('[Show Everything]');
/* handle the individual switchers */
$("span.show-tests[uid]").text('[Show tests]');
$("span.show-asserts[uid]").text('[Show Assert Summary]');
} else {
console.log("show now");
$("div.tests").show("fast");
$("div.asserts").show("fast");
$(this).text('[Hide Everything]');
/* handle the individual switchers */
$("span.show-tests[uid]").text('[Hide tests]');
$("span.show-asserts[uid]").text('[Hide Assert Summary]');
}
});
/* Initially everything is hidden */
$("div.tests").hide();
$("div.asserts").hide();
});
</script>
113
114
<style>
115
div, h1 {
116
117
118
padding: 3px 10px 2px 10px;
}
119
120
121
122
h3 {
padding: 0 0 0 0;
}
123
124
125
.document {
font-family: Arial;
font-size: 11pt;
126
background-color: #EDEDED;
127
128
129
130
131
132
133
134
135
136
}
.description {
font-style: italic;
}
.title {
font-weight: bold;
}
137
138
139
140
141
142
143
144
145
146
147
148
149
.switch {
font-style: italic;
color: rgb(10, 10, 200);
font-size: 10pt;
cursor: pointer;
}
.passedTest {
background-color: green;
}
.failedTest {
background-color: red;
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
}
.statistics {
}
</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>
<xsl:for-each select="testlog/parameters/parameter">
<xsl:value-of select="."/>
</xsl:for-each>
<br/>
<span class="title">Statistics:</span><br/>
<div class="statistics">
171
172
<span>Suites: </span> <xsl:value-of select="testlog/numSuites"/> <br/>
<span>Tests in total: </span> <xsl:value-of select="testlog/numTests"/> <br/>
173
<div>
174
175
<span>Passed tests: </span><xsl:value-of select="testlog/numPassedTests"/> <br/>
<span>Failed tests: </span><xsl:value-of select="testlog/numFailedTests"/> <br/>
176
177
178
179
</div>
</div>
</div>
180
181
182
183
184
185
<div>
<h3>Test results:</h3>
<span class="switch show-all-tests">[Show All Tests] </span>|
<span class="switch show-everything">[Show Everything]</span>
</div>
186
187
188
<xsl:for-each select="testlog/suite">
<div id="suite">
Suite: <xsl:value-of select="name"/> (<xsl:value-of select="startTime"/>)
189
<div class="suiteInfo">
190
191
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/>
192
193
<span class="show-tests switch" uid="{generate-id(test)}">[Show tests]</span>
<div class="tests" uid="{generate-id(test)}">
194
195
196
<xsl:for-each select="test">
<div>
Name: <xsl:value-of select="name"/> (<xsl:value-of select="startTime"/> - <xsl:value-of select="endTime"/> ) <br/>
197
198
199
Description: <span class="description"> <xsl:value-of select="description"/> </span><br/>
Total runtime: <xsl:value-of select="totalRuntime"/> seconds <br/>
200
Result: <xsl:value-of select="result"/> <br/>
201
202
203
<span class="switch show-asserts" uid="{generate-id(assertSummary)}">[Show Assert Summary]</span><br/>
<div class="asserts" uid="{generate-id(assertSummary)}">
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<xsl:for-each select="assert">
<div id="assert">
Assert name: <xsl:value-of select="name"/> <br/>
Result: <xsl:value-of select="result"/> <br/>
Message <xsl:value-of select="message"/> <br/>
Time <xsl:value-of select="time"/> <br/>
</div>
</xsl:for-each>
AssertSummary:
Assert count: <xsl:value-of select="assertSummary/assertCount"/> <br/>
Asserts Passed <xsl:value-of select="assertSummary/assertsPassed"/> <br/>
Asserts Failed <xsl:value-of select="assertSummary/assertsFailed"/> <br/>
</div>
</div>
</xsl:for-each>
</div>
</div>
</div>
</xsl:for-each>
<br/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>