forked from ssspe/gtest-report-prettify
-
Notifications
You must be signed in to change notification settings - Fork 4
/
gtest_template.html
260 lines (229 loc) · 10.1 KB
/
gtest_template.html
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
.number-container {padding: 20px; text-align: center;}
.test-suite-container {margin: 50px;}
.test-button {float: right;}
</style>
<title>Google Test Report</title>
</head>
<body>
<div>
<div class="card test-suite-container">
<h5 class="card-header">{{ test_overview.name }}</h5>
<div class="card-body">
<div class="container">
<div class="row">
<div class="col-sm">
<h4 class="number-container">
<span class="badge badge-pill badge-primary">
Number of tests: {{ test_overview.tests }}
</span>
</h4>
</div>
<div class="col-sm">
<h4 class="number-container">
<span class="badge badge-pill badge-success">
Passed: {{ test_overview.tests - test_overview.failures - test_overview.disabled }}
</span>
</h4>
</div>
<div class="col-sm">
<h4 class="number-container">
<span class="badge badge-pill badge-danger">
Failed: {{ test_overview.failures }}
</span>
</h4>
</div>
<div class="col-sm">
<h4 class="number-container">
<span class="badge badge-pill badge-warning">
Disabled: {{ test_overview.disabled }}
</span>
</h4>
</div>
</div>
</div>
<div class="list-group">
{% for test_suite in test_suites %}
<a href={{"#" + test_suite.name }} class="list-group-item list-group-item-action">
{{ test_suite.name }}
</a>
{% endfor %}
</div>
</div>
</div>
{% for test_suite in test_suites %}
<div class="card test-suite-container" id={{ test_suite.name }}>
<div class="card-header">
<h5>
{{ test_suite.name }}
<div class="btn-group btn-group-toggle test-button" data-toggle="buttons">
<label class="btn btn-primary btn-sm active">
<input type="radio" name="options" id={{ test_suite.name + "All"}} autocomplete="off" checked> Show All
</label>
<label class="btn btn-success btn-sm">
<input type="radio" name="options" id={{ test_suite.name + "Passed"}} autocomplete="off"> Show Only Passed
</label>
<label class="btn btn-danger btn-sm">
<input type="radio" name="options" id={{ test_suite.name + "Failed"}} autocomplete="off"> Show Only Failed
</label>
<label class="btn btn-warning btn-sm">
<input type="radio" name="options" id={{ test_suite.name + "Disabled"}} autocomplete="off"> Show Only Disabled
</label>
</div>
</h5>
</div>
<div class="card-body">
<div class="container">
<div class="row">
<div class="col-sm">
<h4 class="number-container">
<span class="badge badge-pill badge-primary">
Number of tests: {{ test_suite.tests }}
</span>
</h4>
</div>
<div class="col-sm">
<h4 class="number-container">
<span class="badge badge-pill badge-success">
Passed: {{ test_suite.tests - test_suite.failures - test_suite.disabled }}
</span>
</h4>
</div>
<div class="col-sm">
<h4 class="number-container">
<span class="badge badge-pill badge-danger">
Failed: {{ test_suite.failures }}
</span>
</h4>
</div>
<div class="col-sm">
<h4 class="number-container">
<span class="badge badge-pill badge-warning">
Disabled: {{ test_suite.disabled }}
</span>
</h4>
</div>
</div>
</div>
<div class="accordion" id={{ test_suite.name + "FailedTests"}}>
{% for test in test_suite.testsuite %}
{% if test.failures %}
<div class="card border-danger mb-3">
<div class="card-header" id={{ test.name + "FailedHeading" }}>
<h2 class="mb-0">
<button class="btn btn-link text-danger" type="button" data-toggle="collapse" data-target={{"#" + test.name + "FailedCollapse"}} aria-expanded="false" aria-controls={{ test.name + "FailedCollapse"}}>
{{ test.name }}
</button>
</h2>
</div>
<div id={{ test.name + "FailedCollapse" }} class="collapse" aria-labelledby={{ test.name + "FailedHeading" }} data-parent={{ "#" + test_suite.name + "FailedTests"}}>
<div class="card-body">
<h5 class="card-title">{{ "Time: " + test.time }}</h5>
{% for failure in test.failures %}
<p class="card-text">{{ "Failure: " + failure.failure }}</p>
{% endfor %}
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
<div class="accordion" id={{ test_suite.name + "PassedTests"}}>
{% for test in test_suite.testsuite %}
{% if test.status == "RUN" and not test.failures %}
<div class="card border-success mb-3">
<div class="card-header" id={{ test.name + "PassedHeading" }}>
<h2 class="mb-0">
<button class="btn btn-link text-success" type="button" data-toggle="collapse" data-target={{"#" + test.name + "PassedCollapse"}} aria-expanded="false" aria-controls={{ test.name + "PassedCollapse"}}>
{{ test.name }}
</button>
</h2>
</div>
<div id={{ test.name + "PassedCollapse" }} class="collapse" aria-labelledby={{ test.name + "PassedHeading" }} data-parent={{ "#" + test_suite.name + "PassedTests"}}>
<div class="card-body">
<h5 class="card-title">{{ "Time: " + test.time }}</h5>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
<div class="accordion" id={{ test_suite.name + "DisabledTests"}}>
{% for test in test_suite.testsuite %}
{% if test.status == "NOTRUN" and not test.failures %}
<div class="card border-warning mb-3">
<div class="card-header" id={{ test.name + "DisabledHeading" }}>
<h2 class="mb-0">
<button class="btn btn-link text-warning" type="button" data-toggle="collapse" data-target={{"#" + test.name + "DisabledCollapse"}} aria-expanded="false" aria-controls={{ test.name + "DisabledCollapse"}}>
{{ test.name }}
</button>
</h2>
</div>
<div id={{ test.name + "DisabledCollapse" }} class="collapse" aria-labelledby={{ test.name + "DisabledHeading" }} data-parent={{ "#" + test_suite.name + "DisabledTests"}}>
<div class="card-body">
<h5 class="card-title">Disabled Test</h5>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endfor %}
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script>
$("label").click(function()
{
const testDesc = {"Passed": 6, "Failed": 6, "Disabled": 8}
const testDescAll = {"Passed": 6, "Failed": 6, "Disabled": 8, "All": 0}
var testSuiteID = $(this).find("input").attr("id");
showAll(testSuiteID);
for (var testName in testDesc)
{
var tempTestDesc = $.extend({}, testDesc);
if (testSuiteID.includes(testName))
{
// We need to hide everything other than the selected type
var testNameLen = tempTestDesc[testName]
delete tempTestDesc[testName]
for (var tempTestName in tempTestDesc)
{
var tempSuite = generateTestSuiteName(testSuiteID, testNameLen, tempTestName);
$(generateID(tempSuite)).hide();
}
}
}
function showAll(testSuiteID)
{
for (var testName in testDescAll)
{
var tempTestDesc = $.extend({}, testDescAll);
if (testSuiteID.includes(testName))
{
// We want to show everything
for (var tempTestName in tempTestDesc)
{
$(generateID(testSuiteID.replace(testName, tempTestName))).show();
}
}
}
}
function generateTestSuiteName(testSuiteName, len, newName) {
var tempName = testSuiteName.slice(0, -len) + newName;
return tempName;
}
function generateID(testSuiteID) {
return "#" + testSuiteID + "Tests";
}
})
</script>
</body>
</html>