-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtestreport.html
235 lines (214 loc) · 18.6 KB
/
testreport.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
<html>
<head>
<script id="junit-report" type="xml/xmldata"><reports><testsuites>
<testsuite tests="12" failures="10" time="0.720" name="failing-tests">
<properties>
<property name="go.version" value="go1.12.1"></property>
</properties>
<testcase classname="failing-tests" name="it_should_support_defer_even_on_fails" time="0.010"></testcase>
<testcase classname="failing-tests" name="it_should_assert_command" time="0.000">
<failure message="Failed" type=""> + it_should_assert_command
 + assert_true 'ls /xxxtmp'
 + ls /xxxtmp
 ls: /xxxtmp: No such file or directory
 + assert_eq 1 0 'expecting command '\''ls /xxxtmp'\'' to succeed'
 + description='expecting command '\''ls /xxxtmp'\'' to succeed'
 + set +x
 �[1;37;41mfailed expectation:�[m �[1;38;40mexpecting command 'ls /xxxtmp' to succeed ('1' == '0') �[m
 ######################################## FAILED TEST: expecting command 'ls /xxxtmp' to succeed ('1' == '0')
 + exit 1
./failing-tests.sh:25:it_should_assert_command�[m</failure>
</testcase>
<testcase classname="failing-tests" name="it_should_assert_command_with_description" time="0.000">
<failure message="Failed" type=""> + it_should_assert_command_with_description
 + assert_true 'ls /xxxtmp' 'assert_true with a description'
 + ls /xxxtmp
 ls: /xxxtmp: No such file or directory
 + assert_eq 1 0 'assert_true with a description'
 + description='assert_true with a description'
 + set +x
 �[1;37;41mfailed expectation:�[m �[1;38;40massert_true with a description ('1' == '0') �[m
 ######################################## FAILED TEST: assert_true with a description ('1' == '0')
 + exit 1</failure>
</testcase>
<testcase classname="failing-tests" name="it_should_negate_assert_match_correctly" time="0.010">
<failure message="Failed" type=""> + it_should_negate_assert_match_correctly
 + assert_nmatch hallo ll
 + __SPEC_SH_NEGATE=1
 + assert_match hallo ll
 + set +o pipefail
 + printf %s hallo
 + grep -E -m1 -o ll
 + head -n1
 + grep -E ll
 ll
 + assert_eq 0 0 'checking '\''hallo'\'' to match /ll/'
 + description='checking '\''hallo'\'' to match /ll/'
 + set +x
 �[1;37;41mfailed expectation:�[m �[1;38;40mchecking 'hallo' to match /ll/ ('0' != '0') �[m
 ######################################## FAILED TEST: checking 'hallo' to match /ll/ ('0' != '0')
 + exit 1</failure>
</testcase>
<testcase classname="failing-tests" name="it_should_compare_exit_code" time="0.010">
<failure message="Failed" type=""> + it_should_compare_exit_code
 + false
 + assert_eq 0 0
 + description=
 + set +x
 ######################################## PASSED TEST: '0' == '0'
 + assert_eq 0 0 '0 should be 0'
 + description='0 should be 0'
 + set +x
 ######################################## PASSED TEST: 0 should be 0 ('0' == '0')
 + assert_eq 0 2
 + description=
 + set +x
 �[1;37;41mfailed expectation:�[m �[1;38;40m'0' == '2' �[m
 ######################################## FAILED TEST: '0' == '2'
 + exit 1</failure>
</testcase>
<testcase classname="failing-tests" name="it_should_compare_string" time="0.000">
<failure message="Failed" type=""> + it_should_compare_string
 ++ echo hallo
 ++ tr l x
 + assert_eq haxxo haggo
 + description=
 + set +x
 �[1;37;41mfailed expectation:�[m �[1;38;40m'haxxo' == 'haggo' �[m
 ######################################## FAILED TEST: 'haxxo' == 'haggo'
 + exit 1
./failing-tests.sh:51:it_should_compare_string�[m</failure>
</testcase>
<testcase classname="failing-tests" name="it_should_compare_string_with_description" time="0.000">
<failure message="Failed" type=""> + it_should_compare_string_with_description
 ++ echo hallo
 ++ tr l x
 + assert_eq haxxo haggo 'transforming string should work'
 + description='transforming string should work'
 + set +x
 �[1;37;41mfailed expectation:�[m �[1;38;40mtransforming string should work ('haxxo' == 'haggo') �[m
 ######################################## FAILED TEST: transforming string should work ('haxxo' == 'haggo')
 + exit 1</failure>
</testcase>
<testcase classname="failing-tests" name="it_should_match_regexp" time="0.310">
<failure message="Failed" type=""> + it_should_match_regexp
 + sleep 0.3
 + assert_match aaa:88X09 'aaa:[0-9]{5}'
 + set +o pipefail
 + printf %s aaa:88X09
 + grep -E -m1 -o 'aaa:[0-9]{5}'
 + head -n1
 + grep -E 'aaa:[0-9]{5}'
 + assert_eq 1 0 'checking '\''aaa:88X09'\'' to match /aaa:[0-9]{5}/'
 + description='checking '\''aaa:88X09'\'' to match /aaa:[0-9]{5}/'
 + set +x
 �[1;37;41mfailed expectation:�[m �[1;38;40mchecking 'aaa:88X09' to match /aaa:[0-9]{5}/ ('1' == '0') �[m
 ######################################## FAILED TEST: checking 'aaa:88X09' to match /aaa:[0-9]{5}/ ('1' == '0')
 + exit 1</failure>
</testcase>
<testcase classname="failing-tests" name="it_should_negate_assert_correctly" time="0.000">
<failure message="Failed" type=""> + it_should_negate_assert_correctly
 + assert_false 'ls /' 'this test should fail'
 + __SPEC_SH_NEGATE=1
 + assert_true 'ls /' 'this test should fail'
 + ls /
 Applications
 Library
 Network
 System
 Users
 Volumes
 bin
 cores
 dev
 etc
 home
 installer.failurerequests
 net
 opt
 private
 sbin
 tmp
 usr
 var
 + assert_eq 0 0 'this test should fail'
 + description='this test should fail'
 + set +x
 �[1;37;41mfailed expectation:�[m �[1;38;40mthis test should fail ('0' != '0') �[m
 ######################################## FAILED TEST: this test should fail ('0' != '0')
 + exit 1</failure>
</testcase>
<testcase classname="failing-tests" name="it_should_negate_assert_eq_correctly" time="0.000">
<failure message="Failed" type=""> + it_should_negate_assert_eq_correctly
 + assert_neq 1 1
 + __SPEC_SH_NEGATE=1
 + assert_eq 1 1
 + description=
 + set +x
 �[1;37;41mfailed expectation:�[m �[1;38;40m'1' != '1' �[m
 ######################################## FAILED TEST: '1' != '1'
 + exit 1</failure>
</testcase>
<testcase classname="failing-tests" name="it_should_reflect_exit_code" time="0.000">
<failure message="Failed" type=""> + it_should_reflect_exit_code
 + return 3
 + res=3
 + set +x</failure>
</testcase>
<testcase classname="failing-tests" name="after_all" time="0.000"></testcase>
</testsuite>
</testsuites>
<testsuites>
<testsuite tests="13" failures="0" time="1.360" name="passing-tests">
<properties>
<property name="go.version" value="go1.12.1"></property>
</properties>
<testcase classname="passing-tests" name="before_all" time="0.000"></testcase>
<testcase classname="passing-tests" name="it_should_execute_command" time="0.010"></testcase>
<testcase classname="passing-tests" name="it_should_show_correct_duration" time="0.200"></testcase>
<testcase classname="passing-tests" name="it_should_support_defer" time="0.020"></testcase>
<testcase classname="passing-tests" name="it_should_compare_exit_code" time="0.000"></testcase>
<testcase classname="passing-tests" name="it_should_compare_string" time="0.010"></testcase>
<testcase classname="passing-tests" name="it_should_compare_string_with_description" time="0.000"></testcase>
<testcase classname="passing-tests" name="it_should_match_regexp" time="0.000"></testcase>
<testcase classname="passing-tests" name="it_should_negate_correctly" time="0.010"></testcase>
<testcase classname="passing-tests" name="it_should_be_possible_to_skip_a_test" time="0.000">
<skipped message=" skipping test: only works in January"></skipped>
</testcase>
<testcase classname="passing-tests" name="it_should_have_correct_number_of_failing_tests" time="0.750"></testcase>
<testcase classname="passing-tests" name="it_should_execute_external_tests" time="0.000"></testcase>
<testcase classname="passing-tests" name="after_all" time="0.000"></testcase>
</testsuite>
</testsuites></reports></script>
<meta charset="UTF-8">
<script>
// minified https://github.com/honza/140medley/blob/master/140medley.js (just what is needed)
var t=function(a,b ){return function(c,d ){return a.replace(/#{([^}]*)}/g,function(a,e ){return Function("x","with(x)return "+e ).call(c,d ||b ||{})})}};var p=function(a,b,c,d ){c=c||document;d=c[b="on"+b ];a=c[b]=function(e){d=d&&d(e=e||c.event );return(a=a&&b(e))?b :d;};c=this;};var m=function(a,b,c ){b=document;c=b.createElement("p");c.innerHTML=a;a=b.createDocumentFragment();while(b=c.firstChild ){a.appendChild(b);}return a;};var $=function(a,b ){a=a.match(/^(\W)?(.*)/);return(b ||document )["getElement"+(a[1]?a[1]=="#"?"ById":"sByClassName":"sByTagName")](a[2])};
</script>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
var txt = document.getElementById('junit-report').innerHTML;
var xmlDoc;
if (window.DOMParser) {
parser=new DOMParser();
xmlDoc=parser.parseFromString(txt,"text/xml");
} else {
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.loadXML(txt);
}
var testsuites = $('testsuite', xmlDoc);
for(i=0; i<testsuites.length; i++) {
var testsuite = testsuites[i];
var testSuiteData = {
id: 'testsuite-'+i,
tests: testsuite.getAttribute('tests'),
failures: testsuite.getAttribute('failures'),
time: testsuite.getAttribute('time'),
name: testsuite.getAttribute('name').replace(/[_-]/g, " "),
line: testsuite.getAttribute('line')
};
var template = t(
"<div id='#{this.id}' class='testsuite testsuite-#{this.failures > 0 ? 'failure' : 'ok'}'>"+
"<div class='time'>"+
"<div class='skipped'><span>#{this.time}s<\/span><\/div>"+
"<div class='failure'><span>#{this.time}s<\/span><\/div>"+
"<div class='ok'><span>#{this.time}s<\/span><\/div><\/div>"+
"<div class='name'>#{this.name}<\/div>"+
"<div class='summary'>total: 14 | ok: 50 | failures: 14 | skipped: 36<\/div>"+
"<div class='line'><\/div>"+
"<div id='#{this.id}-testcases' class='testcases'><\/div>"+
"<\/div>");
var testsuiteElement = document.body.appendChild(m(template(testSuiteData)));
var testcases = $('testcase', testsuite);
var skipped = 0;
for(j=0; j<testcases.length; j++) {
var testcase = testcases[j];
var data = {
id: 'testsuite-'+i+'-testcase-'+j,
classname: testcase.getAttribute('classname').replace(/[_-]/g, " "),
name: testcase.getAttribute('name').replace(/[_-]/g, " "),
time: testcase.getAttribute('time'),
failure: $('failure', testcase),
skipped: $('skipped', testcase)
};
var template = t(
"<div id='#{this.id}' onclick='var e = this.getElementsByClassName(\"failure-msg\"); if(e.length>0) { e[0].getAttribute(\"style\") == \"display: block\" ? e[0].setAttribute(\"style\", \"display: none\") : e[0].setAttribute(\"style\", \"display: block\") };' class='testcase testcase-#{this.failure.length > 0 ? 'failure' : (this.skipped.length > 0 ? 'skipped' : 'ok')}'>"+
"<div class='time'>#{this.skipped.length > 0 ? 'skipped' : this.time+'s'}<\/div>"+
"<div class='name'>#{this.name}<br/><span class='classname'>#{this.classname}<\/span><\/div>"+
"<\/div>");
testcaseElement = m(template(data));
if(data.failure.length > 0) {
testcaseElement.lastChild.appendChild(m("<div class='failure-details-toggle'>details<\/div><div class='failure-msg'><pre>"+convertAnsiColors(data.failure[0])+"<\/pre><\/div>"));
}
if(data.skipped.length > 0) {
skipped++;
testcaseElement.lastChild.appendChild(m("<div class='failure-details-toggle'>details<\/div><div class='failure-msg'><pre>"+data.skipped[0].getAttribute("message") || "no description given"+"<\/pre><\/div>"));
}
//$('#testsuite-'+i+'-testcases').appendChild(testcaseElement);
$('#testsuite-'+i+'-testcases').appendChild(testcaseElement);
}
$('.summary', $('#testsuite-'+i))[0].innerHTML = "total: "+testSuiteData.tests + " | ok: "+ (testSuiteData.tests - skipped - testSuiteData.failures) +" | failures: " + testSuiteData.failures + " | skipped: " + skipped;
var failed = Math.round(testSuiteData.failures * 100 / testSuiteData.tests);
var ok = Math.round((testSuiteData.tests - skipped - testSuiteData.failures) * 100 / testSuiteData.tests);
var skipped = Math.round(skipped * 100 / testSuiteData.tests);
$('.skipped', $('#testsuite-'+i))[0].style.width = 100 + "%";
$('.failure', $('#testsuite-'+i))[0].style.width = (failed + ok) + "%";
$('.ok', $('#testsuite-'+i))[0].style.width = ok + "%";
}
document.getElementById('junit-report').remove();
});
function convertAnsiColors(s) {
var reAnsiStart = /�\[([0-9]);([0-9][0-9]);([0-9][0-9])m/g;
var reAnsiEnd = /�\[m/g;
return s.textContent
.replace(reAnsiStart, '<span class="ansi-weight-$1 ansi-fg-$2 ansi-bg-$3">')
.replace(reAnsiEnd, '<\/span>')
}
function toggleOkTestsVisibility() {
var okTests = $('.testcase-ok');
var style = $('#show-ok-tests-checkbox').checked ? 'inherit' : 'none';
for(i in okTests) {
if(okTests[i].style) { okTests[i].style.display = style; };
}
}
</script>
<style>
body, html { box-sizing: border-box; background-color: #FFF; color: #111111; font-family: -apple-system, 'Roboto', avenir, roboto, noto, ubuntu, 'helvetica neue', helvetica, arial, sans-serif; }
.ansi-weight-0 {font-weight:normal;}
.ansi-weight-1 {font-weight:bold;}
.black-fg ,.ansi-fg-30 {color: #111111;}
.red-fg ,.ansi-fg-31 {color: #FF4136;}
.green-fg ,.ansi-fg-32 {color: #2ECC40;}
.yellow-fg ,.ansi-fg-33 {color: #FFDC00;}
.blue-fg ,.ansi-fg-34 {color: #0074D9;}
.orange-fg ,.ansi-fg-35 {color: #85144b;}
.teal-fg ,.ansi-fg-36 {color: #39CCCC;}
.white-fg ,.ansi-fg-37 {color: #FF4136;}
pre { white-space: pre-wrap; }
.test-container {display: flex; flex-direction: column; margin: 3em 6em 0em 6em; max-width: 1024px;}
.testsuite {margin-top: 3em; width: 1024 }
.testsuite > .name, .testsuite > .summary { display: inline-block; height: 2em; padding: 1em 1em 0 0; }
.testsuite > .summary { float: right; padding-top: 2em; }
.testsuite> .time { display: inline-block; height: 2em; position: relative; width: 9em; margin: 0em 1em 0em 6em; }
.testsuite> .time div { font-weight: bold; height: 3em; position: absolute; white-space: nowrap; overflow: hidden; }
.testsuite> .time div span { width: 100%; padding: 1em 1em 1em 3em; position: absolute; }
.testsuite> .time > .ok {background-color: rgba(234,250,236,1.0); color: hsla(127, 63%, 15%, 1.0); }
.testsuite> .time > .failure {background-color: rgba(255,236,235,1.0); color: hsla(3, 100%, 25%, 1.0); }
.testsuite> .time > .skipped {background-color: rgba(255,247,204, 1.0); color: #B39700; }
.testsuite > .name {font-weight: bold; font-size: x-large;}
.line {max-width: 1024px; margin: 0.8em 0 1.4em 0; margin-left: 6em; border-bottom: 2px solid #111111;}
.testcase {max-width: 1024px; margin-bottom: 0.5em; margin-left: 6em; }
.testcase div {display: inline-block; height: 2em; padding: 1em 1em 0 1em; }
.testcase:hover {background-color: #FAFAFA; }
.testcase-failure {cursor: pointer; }
.testcase .failure-details-toggle {font-size: xx-small; font-variant: small-caps; display: none; float: right; padding: 2em; }
.testcase:hover .failure-details-toggle {display: inline-block; float: right; }
.testcase .failure-msg {background-color: #FAFAFA; height: auto; display: none; padding: 1em 2em 1em 2em; }
.testcase-ok {display: none; }
.testcase-ok .time {background-color: rgba(46,204,64,0.1); color: hsla(127, 63%, 15%, 1.0); font-weight: bold; width: 7em; text-align: center; }
.testcase-failure .time {background-color: rgba(255,65,54,0.1); color: hsla(3, 100%, 25%, 1.0); font-weight: bold; width: 7em; text-align: center; }
.testcase-skipped .time {background-color: rgba(255, 215, 0, 0.2); color: #B39700; font-weight: bold; width: 7em; text-align: center; }
.testcase .classname {display: none; font-size: xx-small; font-variant:small-caps;}
.white-bg ,.ansi-bg-40 {background-color: #FFFFFF;}
.red-bg ,.ansi-bg-41 {background-color: rgba(255,65,54,0.1);}
.green-bg ,.ansi-bg-42 {background-color: #2ECC40;}
.yellow-bg ,.ansi-bg-43 {background-color: #FFDC00;}
.blue-bg ,.ansi-bg-44 {background-color: #0074D9;}
.orange-bg ,.ansi-bg-45 {background-color: #85144b;}
.teal-bg ,.ansi-bg-46 {background-color: #39CCCC;}
.black-bg ,.ansi-bg-47 {background-color: #111111;}
</style>
<title>Test results</title>
<link rel="icon" type="image/png" href="https://emojipedia-us.s3.amazonaws.com/cache/4d/d9/4dd9122837bcb2f38aeb67981ca8c6fd.png">
</head>
<body>
<div class="test-container">
<h1>Test results</h1>
<label>
<input id="show-ok-tests-checkbox" name="checkbox" onchange="toggleOkTestsVisibility()" type="checkbox" value="show-ok-tests">Show tests that passed
</label>
</div>
</body>
</html>