author | Claus Gittinger <cg@exept.de> |
Sun, 07 Jul 2019 14:54:40 +0200 | |
changeset 754 | a40cfdc417ad |
parent 746 | 1dd7abe88468 |
permissions | -rw-r--r-- |
694 | 1 |
"{ Encoding: utf8 }" |
2 |
||
222 | 3 |
"{ Package: 'stx:goodies/sunit' }" |
4 |
||
606 | 5 |
"{ NameSpace: Smalltalk }" |
6 |
||
222 | 7 |
Object subclass:#TestResultReporter |
332 | 8 |
instanceVariableNames:'result stream' |
9 |
classVariableNames:'' |
|
10 |
poolDictionaries:'' |
|
583
437e5fe6ab3a
Moved to category "SUnit-Smalltalk/X-Report" as it is St/X-specific (and mostly obsolete)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
567
diff
changeset
|
11 |
category:'SUnit-Smalltalk/X-Report' |
222 | 12 |
! |
13 |
||
267 | 14 |
!TestResultReporter class methodsFor:'documentation'! |
15 |
||
16 |
documentation |
|
17 |
" |
|
511 | 18 |
this is used as a last step in jenkins automated builds. |
19 |
||
299 | 20 |
WARNING: |
21 |
this is about to be obsoleted by the reporter classes found in the |
|
315 | 22 |
goodies/builder/ packages. |
299 | 23 |
|
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
24 |
Currently supported formats are: |
307 | 25 |
#xml_jUnit - a junit-like xml format |
298 | 26 |
#xml_pythonUnit - a python unit-like xml format |
27 |
#xml - same, for backward compatibility |
|
28 |
#tap - perl TAP unit test format; |
|
29 |
very naive and simple, but there are tools for it... |
|
277
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
30 |
#xml_perfPublisher |
298 | 31 |
- can be processed by the perfPublisher jenkins/hudson plugin |
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
32 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
33 |
public API entry: |
267 | 34 |
|aTestResult| |
35 |
||
36 |
aTestResult := aUnitTest suite run. |
|
37 |
TestResultReporter report:aTestResult format:#xml on: aStream |
|
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
38 |
|
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
39 |
modifications: |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
40 |
cg: I think the name 'xml' is too unspecific; |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
41 |
I may want to add a whole bunch of additional xml-based formats. |
298 | 42 |
So I changed #xml to xml_pythonUnit (but still support the original #xml for bw-compatibility). |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
43 |
You may be especially interested in xml_perfPublisher, which is great to present |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
44 |
nice reports in jenkins/hudson... |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
45 |
|
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
46 |
[author:] |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
47 |
Jan Vranji |
277
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
48 |
documentation, tap & perfPublisher format added by Claus Gittinger |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
49 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
50 |
[see also:] |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
51 |
TAP |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
52 |
http://testanything.org/wiki/index.php/Main_Page |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
53 |
http://search.cpan.org/~petdance/Test-Harness-2.64/lib/Test/Harness/TAP.pod |
277
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
54 |
|
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
55 |
perfPublisher |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
56 |
http://wiki.hudson-ci.org/display/HUDSON/PerfPublisher+Plugin |
267 | 57 |
" |
58 |
! |
|
59 |
||
60 |
examples |
|
61 |
" |
|
680 | 62 |
Smalltalk loadPackage:'stx/goodies:regression' |
460
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
63 |
|
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
64 |
[exBegin] |
502 | 65 |
|suite result testResult| |
66 |
||
67 |
suite := TestSuite named:'SelfTest'. |
|
68 |
#( |
|
504 | 69 |
'JavaScriptTests' |
502 | 70 |
'FloatTest' |
71 |
'IntegerTest' |
|
72 |
) do:[:className | |
|
73 |
|fullName| |
|
74 |
||
75 |
fullName := ('RegressionTests::',className). |
|
76 |
suite addTest:(Smalltalk classNamed:fullName) suite. |
|
77 |
]. |
|
680 | 78 |
testResult := suite run. |
79 |
TestResultReporter report:testResult format:#xml_jUnit on:Transcript. |
|
502 | 80 |
[exEnd] |
81 |
||
82 |
[exBegin] |
|
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
83 |
|testResult| |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
84 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
85 |
testResult := RegressionTests::IntegerTest suite run. |
680 | 86 |
TestResultReporter report:testResult format:#xml_jUnit on:Transcript. |
494 | 87 |
[exEnd] |
88 |
||
89 |
[exBegin] |
|
90 |
|testResult| |
|
91 |
||
92 |
testResult := RegressionTests::IntegerTest suite run. |
|
680 | 93 |
TestResultReporter report:testResult format:#xml_pythonUnit on:Transcript. |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
94 |
[exEnd] |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
95 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
96 |
[exBegin] |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
97 |
|testResult| |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
98 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
99 |
testResult := RegressionTests::IntegerTest suite run. |
680 | 100 |
TestResultReporter report:testResult format:#tap on:Transcript. |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
101 |
[exEnd] |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
102 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
103 |
[exBegin] |
267 | 104 |
|testResult| |
105 |
||
293 | 106 |
testResult := RegressionTests::CollectionTests suite run. |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
107 |
TestResultReporter report:testResult format:#xml_perfPublisher on:Transcript. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
108 |
[exEnd] |
321 | 109 |
|
110 |
[exBegin] |
|
378 | 111 |
|suite testResult| |
112 |
||
113 |
suite := RegressionTests::WritingToTranscriptOrStdoutTest suite. |
|
114 |
testResult := suite run. |
|
115 |
TestResultReporter report:testResult format:#xml_jUnit on:Transcript. |
|
116 |
[exEnd] |
|
117 |
||
118 |
[exBegin] |
|
321 | 119 |
|testResult| |
120 |
||
121 |
testResult := RegressionTests::NumberTest suite run. |
|
122 |
TestResultReporter report:testResult format:#xml_jUnit on:Transcript. |
|
123 |
[exEnd] |
|
332 | 124 |
[exBegin] |
378 | 125 |
|testResult| |
332 | 126 |
|
378 | 127 |
testResult := RegressionTests::NumberTest suite run. |
128 |
TestResultReporter report:testResult format:#xml_pythonUnit on:Transcript. |
|
129 |
[exEnd] |
|
130 |
[exBegin] |
|
131 |
|testResult| |
|
132 |
||
133 |
testResult := RegressionTests::NumberTest suite run. |
|
380 | 134 |
TestResultReporter report:testResult format:#xml_perfPublisher on:Transcript. |
135 |
[exEnd] |
|
136 |
[exBegin] |
|
137 |
|testResult| |
|
138 |
||
139 |
testResult := RegressionTests::NumberTest suite run. |
|
378 | 140 |
TestResultReporter report:testResult format:#tap on:Transcript. |
332 | 141 |
[exEnd] |
460
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
142 |
|
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
143 |
test an error: |
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
144 |
[exBegin] |
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
145 |
|testResult| |
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
146 |
|
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
147 |
(RegressionTests::AssociationTests includesSelector:#'test_xx_willFail') ifFalse:[ |
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
148 |
Class withoutUpdatingChangesDo:[ |
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
149 |
RegressionTests::AssociationTests compile:'test_xx_willFail self assert:5 > 7.'. |
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
150 |
RegressionTests::AssociationTests compile:'test_xx_willErr self error:''err by purpose''.' |
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
151 |
]. |
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
152 |
]. |
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
153 |
testResult := RegressionTests::AssociationTests suite run. |
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
154 |
TestResultReporter report:testResult format:#xml_jUnit on:Transcript. |
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
155 |
[exEnd] |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
156 |
" |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
157 |
! |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
158 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
159 |
format_tap |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
160 |
" |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
161 |
sample output for one of the st/x regression-tests looks like: |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
162 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
163 |
1..49 |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
164 |
ok 1 - RegressionTests::IntegerTest-testComparing (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
165 |
ok 2 - RegressionTests::IntegerTest-testConstants (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
166 |
ok 3 - RegressionTests::IntegerTest-testCreationFromBytes1 (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
167 |
ok 4 - RegressionTests::IntegerTest-testDivision (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
168 |
ok 5 - RegressionTests::IntegerTest-testEncodeDecode (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
169 |
ok 6 - RegressionTests::IntegerTest-testFactorial (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
170 |
ok 7 - RegressionTests::IntegerTest-testGCD (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
171 |
ok 8 - RegressionTests::IntegerTest-testILC (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
172 |
ok 9 - RegressionTests::IntegerTest-testInline1 (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
173 |
ok 10 - RegressionTests::IntegerTest-testInteger1 (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
174 |
ok 11 - RegressionTests::IntegerTest-testIntegerMisc (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
175 |
... |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
176 |
ok 47 - RegressionTests::IntegerTest-test_gcdBug1 (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
177 |
ok 48 - RegressionTests::IntegerTest-test_gcdBug2 (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
178 |
ok 49 - RegressionTests::IntegerTest-test_gcdBug3 (0ms) |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
179 |
" |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
180 |
! |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
181 |
|
307 | 182 |
format_xml_jUnit |
183 |
" |
|
184 |
sample output for one of the st/x regression-tests looks like: |
|
185 |
||
186 |
<?xml version='1.0' encoding='UTF-8' ?> |
|
187 |
<testsuite errors='1' failures='0' hostname='hazelnut.osuosl.org' name='net.cars.engine.BougieTest' tests='2' time='0.017' timestamp='2007-11-02T23:13:50'> |
|
188 |
<properties> |
|
189 |
<property name='java.vendor' value='IBM Corporation' /> |
|
190 |
<property name='os.name' value='Linux' /> |
|
191 |
<property name='sun.boot.class.path' value='/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/vm.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/core.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/charsets.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/graphics.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/security.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/ibmpkcs.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/ibmorb.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/ibmcfw.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/ibmorbapi.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/ibmjcefw.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/ibmjgssprovider.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/ibmjsseprovider2.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/ibmjaaslm.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/ibmcertpathprovider.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/server.jar:/opt/ibm-jdk-bin-1.5.0.5a/jre/lib/xml.jar' /> |
|
192 |
<property name='sun.java2d.fontpath' value='' /> |
|
193 |
<property name='java.vm.specification.vendor' value='Sun Microsystems Inc.' /> |
|
194 |
<property name='ant.home' value='/home/jancumps/project/continuus/ant/distro' /> |
|
195 |
... |
|
196 |
</properties> |
|
197 |
<testcase classname='net.cars.engine.BougieTest' name='sparkDry' time='0.0010' /> |
|
198 |
<testcase classname='net.cars.engine.BougieTest' name='sparkHumid' time='0.0050'> |
|
199 |
<error message='humidity level too high' type='java.lang.RuntimeException'>java.lang.RuntimeException: humidity level too high |
|
200 |
at net.cars.engine.Bougie.spark(Unknown Source) |
|
201 |
at net.cars.engine.BougieTest.sparkHumid(BougieTest.java:36) |
|
460
86b22cd3896e
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
202 |
</error> |
307 | 203 |
</testcase> |
204 |
<system-out><!![CDATA[]]></system-out> |
|
205 |
<system-err><!![CDATA[]]></system-err> |
|
206 |
</testsuite> |
|
207 |
" |
|
208 |
! |
|
209 |
||
277
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
210 |
format_xml_perfPublisher |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
211 |
" |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
212 |
sample output looks like: |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
213 |
|
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
214 |
<report name='GeneratedReport-0' categ='GeneratedReport'> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
215 |
<start> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
216 |
<date format='YYYYMMDD' val='20000101' /> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
217 |
<time format='HHMMSS' val='195043' /> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
218 |
</start> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
219 |
<test name='/file_0/test_0' executed='yes'> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
220 |
<description><!![CDATA[This is the description of the test number 0 member of the 0 file.]]></description> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
221 |
<targets> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
222 |
<target threaded='false'>PHP</target> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
223 |
</targets> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
224 |
<platform name='Plateform_0' remote='unknown' capspool='unknown'> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
225 |
<os> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
226 |
<type><!![CDATA[Linux-2.6.26-2-amd64-x86_64-with-glibc2.3.2]]></type> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
227 |
<name><!![CDATA[Linux]]></name> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
228 |
<version><!![CDATA[2.6.26-2-amd64]]></version> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
229 |
<distribution><!![CDATA[Linux-2.6.26-2-amd64-x86_64-with-debian-5.0.3]]></distribution> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
230 |
</os> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
231 |
<processor arch='x86_64'> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
232 |
<frequency unit='MHz' cpufreq='2667.000' /> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
233 |
</processor> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
234 |
<hardware><!![CDATA[nVidia Corporation GeForce 8500 GT (rev a1)]]></hardware> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
235 |
<hardware><!![CDATA[nVidia Corporation GT200 [Tesla C1060 / Tesla S1070] (rev a1)]]></hardware> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
236 |
<compiler name='ifort' version='11.0 20090131' path='.' /> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
237 |
<environment>{PUT HERE ALL YOUR LIBS AND THE DESCRIPTION OF YOUR TEST ENVIRONMENT}</environment> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
238 |
</platform> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
239 |
<commandline rank='0' time='20100128-195406.590832' duration='0.599782943726'>the_first_command_executed</commandline> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
240 |
<commandline rank='1' time='20100128-195406.590832' duration='0.599782943726'>the_second_command_executed</commandline> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
241 |
<result> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
242 |
<success passed='no' state='70' hasTimedOut='false' /> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
243 |
<compiletime unit='s' mesure='1.456467636167308' isRelevant='false' /> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
244 |
<performance unit='GFLOPs' mesure='39.621634393187904' isRelevant='false' /> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
245 |
<executiontime unit='s' mesure='1.5300645576307736' isRelevant='false' /> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
246 |
<errorlog><!![CDATA[EXEMPLE OF ERROR LOG]]></errorlog> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
247 |
<log name='NameOfLogNumber0'><!![CDATA[Here it's another of other log]]></log> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
248 |
<log name='NameOfLogNumber1'><!![CDATA[Here it's another of other log]]></log> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
249 |
</result> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
250 |
</test> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
251 |
<test name='/file_0/test_1' executed='yes'> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
252 |
... |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
253 |
</result> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
254 |
</test> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
255 |
</report> |
ef4b0fd291a8
added: #format_xml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
276
diff
changeset
|
256 |
" |
298 | 257 |
! |
258 |
||
259 |
format_xml_pythonUnit |
|
260 |
" |
|
261 |
sample output for one of the st/x regression-tests looks like: |
|
262 |
||
263 |
<?xml version='1.0'?> |
|
264 |
<unittest-results> |
|
265 |
<test duration='0' |
|
266 |
status='success' |
|
267 |
ficture='RegressionTests::IntegerTest' |
|
268 |
name='testComparing' |
|
269 |
file='RegressionTests::IntegerTest.st'> |
|
270 |
</test> |
|
271 |
<test duration='0' |
|
272 |
status='success' |
|
273 |
ficture='RegressionTests::IntegerTest' |
|
274 |
name='testConstants' |
|
275 |
file='RegressionTests::IntegerTest.st'> |
|
276 |
</test> |
|
277 |
<test duration='0' |
|
278 |
status='success' |
|
279 |
ficture='RegressionTests::IntegerTest' |
|
280 |
name='testCreationFromBytes1' |
|
281 |
file='RegressionTests::IntegerTest.st'> |
|
282 |
</test> |
|
283 |
<test duration='0' |
|
284 |
status='success' |
|
285 |
ficture='RegressionTests::IntegerTest' |
|
286 |
name='testDivision' |
|
287 |
file='RegressionTests::IntegerTest.st'> |
|
288 |
</test> |
|
289 |
<test duration='0' |
|
290 |
status='success' |
|
291 |
ficture='RegressionTests::IntegerTest' |
|
292 |
name='testEncodeDecode' |
|
293 |
file='RegressionTests::IntegerTest.st'> |
|
294 |
</test> |
|
295 |
... |
|
296 |
</unittest-results> |
|
297 |
" |
|
267 | 298 |
! ! |
299 |
||
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
300 |
!TestResultReporter class methodsFor:'queries'! |
267 | 301 |
|
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
302 |
supportedFormats |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
303 |
"return a list of formats and short-info-string, as per supported format symbol" |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
304 |
|
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
305 |
^ #( |
307 | 306 |
(#'xml_jUnit' 'a junit-like xml format') |
298 | 307 |
(#'xml_pythonUnit' 'a python unit-like xml format') |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
308 |
(#'xml_perfPublisher' 'xml-based format for jenkins/hudson') |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
309 |
(#'tap' 'perl TAP unit test format') |
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
310 |
) |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
311 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
312 |
"Created: / 30-07-2011 / 10:18:18 / cg" |
267 | 313 |
! ! |
222 | 314 |
|
315 |
!TestResultReporter class methodsFor:'reporting'! |
|
316 |
||
317 |
report: aTestResult format: format as: stringOrFilename |
|
318 |
||
319 |
self new report: aTestResult format: format as: stringOrFilename |
|
320 |
! |
|
321 |
||
322 |
report: aTestResult format: format on: stream |
|
323 |
||
324 |
self new report: aTestResult format: format on: stream |
|
267 | 325 |
|
326 |
" |
|
327 |
self report:(RegressionTests::IntegerTest runTests) format:#xml on:Transcript |
|
328 |
" |
|
329 |
||
330 |
"Modified (comment): / 30-07-2011 / 09:37:53 / cg" |
|
222 | 331 |
! ! |
332 |
||
333 |
!TestResultReporter methodsFor:'reporting'! |
|
334 |
||
267 | 335 |
report:formatSymbol |
336 |
"currently supported formatSymbols: |
|
298 | 337 |
xml_pythonUnit, xml_perfPublisher, tap" |
267 | 338 |
|
222 | 339 |
|reportFormatSelector| |
340 |
||
267 | 341 |
reportFormatSelector := self reportFormatSelector:formatSymbol. |
222 | 342 |
(self respondsTo: reportFormatSelector) |
267 | 343 |
ifTrue:[self perform: reportFormatSelector] |
344 |
ifFalse:[self error:'Unsupported format: ', formatSymbol]. |
|
345 |
||
298 | 346 |
"Modified (comment): / 03-08-2011 / 12:57:54 / cg" |
222 | 347 |
! |
348 |
||
349 |
report: aTestResult format: format as: stringOrFilename |
|
350 |
||
351 |
| s | |
|
352 |
s := stringOrFilename asFilename writeStream. |
|
353 |
[ self report: aTestResult format: format on: s] |
|
324 | 354 |
ensure:[s close]. |
222 | 355 |
! |
356 |
||
357 |
report: aTestResult format: aSymbol on: aStream |
|
358 |
||
359 |
result := aTestResult. |
|
360 |
stream := aStream. |
|
361 |
self report: aSymbol |
|
362 |
! |
|
363 |
||
364 |
reportFormatSelector:format |
|
606 | 365 |
^ ('report' , format asString asUppercaseFirst) asSymbol |
222 | 366 |
! ! |
367 |
||
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
368 |
!TestResultReporter methodsFor:'reporting - tap'! |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
369 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
370 |
reportTap |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
371 |
"TAP (perl unit test) report format" |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
372 |
|
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
373 |
|idx reportWithStatus| |
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
374 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
375 |
"example: |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
376 |
1..4 |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
377 |
ok 1 - Input file opened |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
378 |
not ok 2 - First line of the input valid |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
379 |
ok 3 - Read the rest of the file |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
380 |
not ok 4 - Summarized correctly # TODO Not written yet |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
381 |
" |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
382 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
383 |
"/ what about not-executed tests - why only runCount ? |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
384 |
stream nextPutLine: ('1..%1' bindWith:result runCount). |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
385 |
|
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
386 |
reportWithStatus := |
378 | 387 |
[:testOutComes :status | |
388 |
testOutComes do:[:each | self reportTapTest: each index: idx result: status. idx := idx + 1 ] |
|
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
389 |
]. |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
390 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
391 |
idx := 1. |
378 | 392 |
reportWithStatus value:result passedOutcomes value:#success. |
393 |
reportWithStatus value:result failureOutcomes value:#failure. |
|
394 |
reportWithStatus value:result errorOutcomes value:#error. |
|
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
395 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
396 |
"Created: / 30-07-2011 / 10:12:31 / cg" |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
397 |
! |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
398 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
399 |
reportTapTest: test index:index result: testResult |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
400 |
| testClassName executionTime testDescription statusString| |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
401 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
402 |
testClassName := self sunitNameOf: test class. |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
403 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
404 |
"most tests do not know, and return nil here!!" |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
405 |
executionTime := test executionTime ? 0.0. |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
406 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
407 |
testDescription := '%1-%2 (%3ms)' |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
408 |
bindWith:testClassName |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
409 |
with:test selector |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
410 |
with:executionTime. |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
411 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
412 |
statusString := (testResult == #success) |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
413 |
ifTrue:['ok'] |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
414 |
ifFalse:['not ok']. |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
415 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
416 |
stream nextPutLine:('%1 %2 - %3' |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
417 |
bindWith:statusString |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
418 |
with:index |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
419 |
with:testDescription). |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
420 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
421 |
"Created: / 30-07-2011 / 10:28:06 / cg" |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
422 |
! ! |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
423 |
|
307 | 424 |
!TestResultReporter methodsFor:'reporting - xml-jUnit'! |
425 |
||
378 | 426 |
errorMessageFromExceptionDetailOf:testOutcome |
324 | 427 |
|detail| |
428 |
||
378 | 429 |
detail := testOutcome exceptionDetail. |
324 | 430 |
detail isNil ifTrue:[ |
431 |
^ 'no error message'. |
|
432 |
]. |
|
433 |
||
320
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
434 |
"Smalltalk/X dialect detection..." |
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
435 |
((Smalltalk respondsTo: #isSmalltalkX) and:[Smalltalk isSmalltalkX]) ifTrue:[ |
324 | 436 |
"exception specific description string" |
464
0cc90bf84720
changed: #errorMessageFromExceptionDetailOf:
Claus Gittinger <cg@exept.de>
parents:
463
diff
changeset
|
437 |
^ detail at:#description ifAbsent:[ (detail at:#exception) description] |
324 | 438 |
]. |
439 |
||
440 |
^ 'no error message (no dialect specific extractor)'. |
|
441 |
||
442 |
"Created: / 07-08-2011 / 12:45:45 / cg" |
|
443 |
! |
|
444 |
||
378 | 445 |
errorTypeFromExceptionDetailOf:testOutcome |
324 | 446 |
|detail| |
447 |
||
378 | 448 |
detail := testOutcome exceptionDetail. |
324 | 449 |
detail isNil ifTrue:[ |
450 |
^ 'unknown error type'. |
|
451 |
]. |
|
452 |
||
453 |
"Smalltalk/X dialect detection..." |
|
567 | 454 |
((Smalltalk respondsTo: #isSmalltalkX) and:[Smalltalk isSmalltalkX]) ifTrue:[ |
455 |
|exception| |
|
324 | 456 |
"class name of the exception" |
567 | 457 |
exception := detail at:#exception. |
458 |
exception isBehavior ifTrue:[ |
|
459 |
^ exception name. |
|
460 |
]. |
|
461 |
^ exception printString. |
|
324 | 462 |
]. |
463 |
||
464 |
^ 'unknown error type (no dialect specific extractor)'. |
|
465 |
||
466 |
"Created: / 07-08-2011 / 13:06:44 / cg" |
|
467 |
! |
|
468 |
||
378 | 469 |
reportTracebackFromExceptionDetailOf:testOutcome |
324 | 470 |
|detail| |
471 |
||
378 | 472 |
detail := testOutcome exceptionDetail. |
428
c33079efa6f3
changed: #reportTracebackFromExceptionDetailOf:
Claus Gittinger <cg@exept.de>
parents:
380
diff
changeset
|
473 |
detail notNil ifTrue:[ |
c33079efa6f3
changed: #reportTracebackFromExceptionDetailOf:
Claus Gittinger <cg@exept.de>
parents:
380
diff
changeset
|
474 |
"Smalltalk/X dialect detection..." |
c33079efa6f3
changed: #reportTracebackFromExceptionDetailOf:
Claus Gittinger <cg@exept.de>
parents:
380
diff
changeset
|
475 |
((Smalltalk respondsTo: #isSmalltalkX) and:[Smalltalk isSmalltalkX]) ifTrue:[ |
714 | 476 |
HTMLUtilities |
477 |
escapeCharacterEntities:(detail at:#backtrace) |
|
478 |
on:stream |
|
428
c33079efa6f3
changed: #reportTracebackFromExceptionDetailOf:
Claus Gittinger <cg@exept.de>
parents:
380
diff
changeset
|
479 |
]. |
320
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
480 |
]. |
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
481 |
|
324 | 482 |
"Created: / 07-08-2011 / 12:46:19 / cg" |
714 | 483 |
"Modified: / 21-06-2018 / 07:39:40 / Claus Gittinger" |
320
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
484 |
! |
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
485 |
|
307 | 486 |
reportXml_jUnit |
487 |
"jUnit-like XML unittest report format" |
|
488 |
||
489 |
stream |
|
490 |
nextPutLine: '<?xml version="1.0"?>'; |
|
491 |
nextPutAll: '<testsuite'; |
|
494 | 492 |
nextPutAll:(' tests="%1"' bindWith:result runCount); |
709 | 493 |
nextPutAll:(' timestamp="%1"' bindWith:result timestamp printStringIso8601); |
494 | 494 |
nextPutAll:(' time="%1"' bindWith:result executionTime); |
307 | 495 |
nextPutAll:(' errors="%1"' bindWith:result errors size); |
496 | 496 |
nextPutAll:(' failures="%1"' bindWith:result failures size). |
497 |
result skipped size > 0 ifTrue:[ |
|
498 |
stream |
|
499 |
nextPutAll:(' skipped="%1"' bindWith:result skipped size). |
|
500 |
]. |
|
501 |
stream |
|
307 | 502 |
nextPutAll:(' hostname="%1"' bindWith:OperatingSystem getHostName); |
494 | 503 |
nextPutAll:(' name="%1"' bindWith:result name); |
307 | 504 |
nextPutLine: '>'. |
505 |
stream |
|
506 |
nextPutLine: ' <properties>'; |
|
483 | 507 |
nextPutLine: ' <property name="programmingLanguage" value="Smalltalk" />'; |
694 | 508 |
nextPutLine: ' <property name="smalltalk.vendor" value="eXept Software AG" />'; |
307 | 509 |
nextPutLine: ' <property name="smalltalk.compiler" value="Smalltalk/X" />'; |
510 |
nextPutLine:(' <property name="smalltalk.version" value="%1" />'bindWith:Smalltalk versionString); |
|
511 |
nextPutLine:(' <property name="os.name" value="%1" />' bindWith:OperatingSystem osName); |
|
483 | 512 |
nextPutLine:(' <property name="os.arch" value="%1" />' bindWith:OperatingSystem getCPUType); |
746 | 513 |
nextPutLine:(' <property name="os.host" value="%1" />' bindWith:OperatingSystem getHostName); |
308 | 514 |
nextPutLine:(' <property name="user.name" value="%1" />' bindWith:OperatingSystem getLoginName); |
483 | 515 |
nextPutLine:(' <property name="user.language" value="%1" />' bindWith:Smalltalk language). |
746 | 516 |
|
517 |
(ProjectDefinition allSubclasses copy sort:[:a :b | a package < b package]) |
|
518 |
do:[:each | |
|
519 |
|id| |
|
520 |
||
521 |
each isAbstract ifFalse:[ |
|
522 |
id := (each package |
|
523 |
copyReplaceString:'::' withString:'_') |
|
524 |
copyReplaceAll:'/' with:'_'. |
|
525 |
stream |
|
526 |
nextPutLine:(' <property name="smalltalk.package.%1.version" value="%2" />' |
|
527 |
bindWith:id |
|
528 |
with:each productVersion). |
|
529 |
"/ stream |
|
530 |
"/ nextPutLine:(' <property name="smalltalk.package.%1.revision" value="%2" />' |
|
531 |
"/ bindWith:id |
|
532 |
"/ with:each revision). |
|
533 |
]. |
|
534 |
]. |
|
483 | 535 |
stream |
307 | 536 |
nextPutLine: ' </properties>'. |
537 |
||
378 | 538 |
result passedOutcomes do:[:eachOutcome | self reportXml_jUnitTest: eachOutcome ]. |
490 | 539 |
result skippedOutcomes do:[:eachOutcome | self reportXml_jUnitTest: eachOutcome ]. |
378 | 540 |
result failureOutcomes do:[:eachOutcome | self reportXml_jUnitTest: eachOutcome ]. |
541 |
result errorOutcomes do:[:eachOutcome | self reportXml_jUnitTest: eachOutcome ]. |
|
307 | 542 |
|
543 |
stream |
|
544 |
nextPutLine: '</testsuite>' |
|
545 |
||
546 |
"Created: / 05-08-2011 / 15:21:45 / cg" |
|
694 | 547 |
"Modified: / 21-11-2017 / 15:52:42 / mawalch" |
746 | 548 |
"Modified: / 28-03-2019 / 15:25:01 / Claus Gittinger" |
307 | 549 |
! |
550 |
||
378 | 551 |
reportXml_jUnitResultAndTraceback:testOutcome state:state |
324 | 552 |
|stateTag errorMessage errorType| |
307 | 553 |
|
320
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
554 |
(state = 'error') ifTrue:[ |
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
555 |
stateTag := 'error'. |
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
556 |
errorMessage := 'unclassified error'. |
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
557 |
] ifFalse:[ |
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
558 |
stateTag := 'failure'. |
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
559 |
errorMessage := 'unclassified failure'. |
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
560 |
]. |
5e253c584276
added: #errorMessageFromDetail:
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
561 |
|
324 | 562 |
" |
563 |
retrieves a single line error message; we use the exception's name or description |
|
564 |
" |
|
378 | 565 |
errorMessage := self errorMessageFromExceptionDetailOf:testOutcome. |
566 |
errorType := self errorTypeFromExceptionDetailOf:testOutcome. |
|
495 | 567 |
errorMessage := errorMessage copyReplaceAll:$" withAll:'"'. |
307 | 568 |
|
569 |
stream |
|
504 | 570 |
nextPutAll:(' <%1 message="%2" type="%3">' |
571 |
bindWith:stateTag |
|
572 |
with:errorMessage |
|
573 |
with:errorType); |
|
324 | 574 |
cr. |
307 | 575 |
|
576 |
" |
|
324 | 577 |
Prints a traceback to the stream. |
578 |
This is dialect-specific, so we have to check... |
|
307 | 579 |
" |
378 | 580 |
self reportTracebackFromExceptionDetailOf:testOutcome. |
307 | 581 |
|
582 |
stream |
|
324 | 583 |
nextPutAll:(' </%1>' bindWith:stateTag); |
584 |
cr. |
|
307 | 585 |
|
586 |
"Created: / 05-08-2011 / 15:40:09 / cg" |
|
587 |
! |
|
588 |
||
378 | 589 |
reportXml_jUnitTest:testOutcome |
498 | 590 |
|testClassName testClass testClassSourceFile executionTime executionTimeString |
735 | 591 |
test testResult testResultXML javaPackagePrefix| |
378 | 592 |
|
593 |
test := testOutcome testCase. |
|
735 | 594 |
testResult := testResultXML := testOutcome result. |
595 |
testResult = 'skip' ifTrue:[ |
|
596 |
testResultXML := 'skipped' |
|
597 |
]. |
|
598 |
||
307 | 599 |
testClassName := self sunitNameOf: test class. |
527
4d28e3a48836
changed: #reportXml_jUnitTest:
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
600 |
"/ prepend package, so it looks like a Java-class path |
4d28e3a48836
changed: #reportXml_jUnitTest:
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
601 |
javaPackagePrefix := (test class package copyTransliterating:':/' to:'..'),'.'. |
307 | 602 |
|
378 | 603 |
(executionTime := testOutcome executionTime) isNil ifTrue:[ |
604 |
executionTimeString := '0.0'. |
|
307 | 605 |
] ifFalse:[ |
378 | 606 |
executionTimeString := ((executionTime / 1000) asFixedPoint:3) printString. |
307 | 607 |
]. |
608 |
||
609 |
stream |
|
463
3907fd5386e8
changed: #reportXml_jUnitTest:
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
610 |
nextPutAll:' <testcase'; |
527
4d28e3a48836
changed: #reportXml_jUnitTest:
Claus Gittinger <cg@exept.de>
parents:
511
diff
changeset
|
611 |
nextPutAll:(' classname="%1"' bindWith:(javaPackagePrefix,testClassName)); |
463
3907fd5386e8
changed: #reportXml_jUnitTest:
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
612 |
nextPutAll:(' name="%1"' bindWith:test selector); |
735 | 613 |
nextPutAll:(' status="%1"' bindWith:testResultXML); |
463
3907fd5386e8
changed: #reportXml_jUnitTest:
Claus Gittinger <cg@exept.de>
parents:
460
diff
changeset
|
614 |
nextPutAll:(' time="%1"' bindWith:executionTimeString). |
324 | 615 |
|
734 | 616 |
((testResult = TestResult statePass or:[testResult = TestResult stateSkip]) |
504 | 617 |
and:[ testOutcome collectedOutput isEmptyOrNil ]) ifTrue:[ |
618 |
stream nextPutAll:'/>'; cr. |
|
311
e57753c959e5
changed: #reportXml_jUnitTest:result:
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
619 |
] ifFalse:[ |
324 | 620 |
stream nextPutAll:'>'; cr. |
504 | 621 |
|
735 | 622 |
(testResult ~= TestResult statePass and:[testResult ~= TestResult stateSkip]) ifTrue:[ |
504 | 623 |
self reportXml_jUnitResultAndTraceback:testOutcome state:testResult. |
477
7642117622ae
changed: #reportXml_jUnitTest:
Claus Gittinger <cg@exept.de>
parents:
464
diff
changeset
|
624 |
|
504 | 625 |
"/ generate a link to the source file |
626 |
testClass := Smalltalk classNamed:testClassName. |
|
627 |
testClass notNil ifTrue:[ |
|
628 |
testClassSourceFile := TestResultStX sourceFilenameOfClass:testClass. |
|
629 |
testClassSourceFile notNil ifTrue:[ |
|
630 |
stream |
|
631 |
nextPutAll:' <system-err>'; cr; |
|
632 |
nextPutAll:('[[ATTACHMENT|%1]]' bindWith:testClassSourceFile); cr; |
|
633 |
nextPutAll:' </system-err>'; cr. |
|
634 |
] |
|
635 |
]. |
|
477
7642117622ae
changed: #reportXml_jUnitTest:
Claus Gittinger <cg@exept.de>
parents:
464
diff
changeset
|
636 |
]. |
504 | 637 |
|
638 |
testOutcome collectedOutput notEmptyOrNil ifTrue:[ |
|
639 |
stream |
|
567 | 640 |
nextPutAll:' <system-out><!![CDATA['; cr; |
641 |
nextPutAll: testOutcome collectedOutput; |
|
642 |
nextPutAll:']]> </system-out>'; cr. |
|
504 | 643 |
]. |
644 |
||
645 |
stream nextPutAll:' </testcase>'; cr. |
|
311
e57753c959e5
changed: #reportXml_jUnitTest:result:
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
646 |
]. |
307 | 647 |
|
378 | 648 |
"Created: / 18-08-2011 / 20:30:50 / cg" |
735 | 649 |
"Modified: / 26-03-2019 / 19:04:54 / Claus Gittinger" |
307 | 650 |
! ! |
651 |
||
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
652 |
!TestResultReporter methodsFor:'reporting - xml-perfPublisher'! |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
653 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
654 |
reportXml_perfPublisher |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
655 |
"xml-based format for hudson/jenkins" |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
656 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
657 |
|reportName reportCategory testClass startTime| |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
658 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
659 |
reportName := result name. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
660 |
reportCategory := 'uncategorized'. "/ it is a required attribute; so what should we use ? |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
661 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
662 |
(testClass := Smalltalk at:reportName asSymbol) isBehavior ifTrue:[ |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
663 |
reportCategory := testClass category. "/ at least, something to show |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
664 |
]. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
665 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
666 |
"/ compute the startTime from the earliest time found in the set of tests |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
667 |
startTime := result timestamp. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
668 |
startTime isNil ifTrue:[ |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
669 |
startTime := (result tests |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
670 |
collect:[:each | each startTime] |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
671 |
thenSelect:[:timeOrNil | timeOrNil notNil]) min. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
672 |
]. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
673 |
startTime := (startTime ? Time now) asTime. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
674 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
675 |
stream |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
676 |
nextPutLine: '<?xml version="1.0"?>'; |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
677 |
nextPutLine:('<report name="%1" categ="%2">' bindWith:reportName with:reportCategory); |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
678 |
nextPutLine:(' <start>'); |
278
b8c0fa1c1934
changed: #reportXml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
679 |
nextPutLine:(' <date format="YYYYMMDD" val="%1" />' bindWith:(Date today printStringFormat:'%y%m%d')); |
b8c0fa1c1934
changed: #reportXml_perfPublisher
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
680 |
nextPutLine:(' <time format="HHMMSS" val="%1" />' bindWith:(startTime printStringFormat:'%h%m%s')); |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
681 |
nextPutLine:(' </start>'). |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
682 |
|
378 | 683 |
result passedOutcomes do:[:each|self reportXml_perfPublisher: each result: #success]. |
684 |
result failureOutcomes do:[:each|self reportXml_perfPublisher: each result: #failure]. |
|
490 | 685 |
result skippedOutcomes do:[:each|self reportXml_perfPublisher: each result: #error]. |
378 | 686 |
result errorOutcomes do:[:each|self reportXml_perfPublisher: each result: #error]. |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
687 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
688 |
stream |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
689 |
nextPutLine: '</report>' |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
690 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
691 |
"Created: / 30-07-2011 / 11:45:15 / cg" |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
692 |
! |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
693 |
|
378 | 694 |
reportXml_perfPublisher: testOutcome result: testResult |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
695 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
696 |
" |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
697 |
Example: |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
698 |
<test |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
699 |
name='test_format_link_not_in_repos_with_line' |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
700 |
executed='exec-status' |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
701 |
<result> |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
702 |
<success passed='result-status' state='result-state'/> |
293 | 703 |
<errorlog><!![CDATA[EXEMPLE OF ERROR LOG]]></errorlog> |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
704 |
</result> |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
705 |
</test> |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
706 |
" |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
707 |
|
378 | 708 |
|test testClassName executionTime testName testDescription |
293 | 709 |
successPassed successState exceptionInfo |
710 |
compilerName compilerVersion compilerConfiguration compilerVersionDate |
|
711 |
timeUnit timeMeasure |
|
712 |
sysInfo osType osVersion cpuType| |
|
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
713 |
|
378 | 714 |
test := testOutcome testCase. |
715 |
||
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
716 |
testClassName := self sunitNameOf: test class. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
717 |
testName := test selector. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
718 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
719 |
"most tests do not know, and return nil here!!" |
380 | 720 |
executionTime := testOutcome executionTime ? 0. "/ millis |
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
721 |
testDescription := '%1-%2' bindWith:testClassName with:testName. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
722 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
723 |
successPassed := (testResult == #success) ifTrue:['yes'] ifFalse:['no']. |
734 | 724 |
(testResult ~~ #success and:[testResult ~~ #skipped]) ifTrue:[ |
380 | 725 |
exceptionInfo := testOutcome exceptionDetail. |
293 | 726 |
]. |
727 |
||
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
728 |
successState := 'foo'. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
729 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
730 |
"/ caveat: the following needs to be made dialect-specific |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
731 |
compilerName := 'Smalltalk/X'. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
732 |
compilerVersion := Smalltalk versionString. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
733 |
compilerConfiguration := Smalltalk configuration. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
734 |
compilerVersionDate := Smalltalk versionDate. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
735 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
736 |
sysInfo := OperatingSystem getSystemInfo. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
737 |
osType := (sysInfo at:#osType ifAbsent:'?'). |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
738 |
osVersion := (sysInfo at:#release ifAbsent:'?'). |
273
72af4634684c
changed: #reportXml_perfPublisher:result:
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
739 |
|
72af4634684c
changed: #reportXml_perfPublisher:result:
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
740 |
cpuType := (sysInfo at:#cpuType ifAbsent:'?'). |
72af4634684c
changed: #reportXml_perfPublisher:result:
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
741 |
"/ cpuSpeed := (sysInfo at:#cpuSpeed ifAbsent:'?'). |
72af4634684c
changed: #reportXml_perfPublisher:result:
Claus Gittinger <cg@exept.de>
parents:
272
diff
changeset
|
742 |
|
275
a215bd80225f
changed: #reportXml_perfPublisher:result:
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
743 |
timeUnit := 'ms'. |
285
421cbd4c52af
changed: #reportXml_perfPublisher:result:
Claus Gittinger <cg@exept.de>
parents:
283
diff
changeset
|
744 |
timeMeasure := executionTime. |
275
a215bd80225f
changed: #reportXml_perfPublisher:result:
Claus Gittinger <cg@exept.de>
parents:
274
diff
changeset
|
745 |
|
734 | 746 |
testResult == #skipped ifTrue:[ |
747 |
stream |
|
748 |
nextPutLine:('<test name="%1" executed="no">' bindWith: testName); |
|
749 |
nextPutLine:(' <description><!![CDATA[%1]]></description>' bindWith: testDescription) |
|
750 |
] ifFalse:[ |
|
751 |
stream |
|
752 |
nextPutLine:('<test name="%1" executed="yes">' bindWith: testName); |
|
753 |
nextPutLine:(' <description><!![CDATA[%1]]></description>' bindWith: testDescription); |
|
754 |
nextPutLine:' <platform>'; |
|
755 |
nextPutLine:' <os>'; |
|
756 |
nextPutLine:(' <type><!![CDATA[%1]]></type>' bindWith:osType); |
|
757 |
nextPutLine:(' <version><!![CDATA[%1]]></version>' bindWith:osVersion); |
|
758 |
nextPutLine:' </os>'; |
|
759 |
nextPutLine:(' <processor arch="%1" wordLength="%2">' bindWith:cpuType with:(ExternalBytes sizeofPointer * 8)); |
|
760 |
"/ nextPutLine:(' <frequency> unit="Mhz" cpufreq="%1" />' bindWith:cpuSpeed); |
|
761 |
nextPutLine:' </processor>'; |
|
762 |
nextPutLine:(' <compiler name="%1" version="%2" versiondate="%3" configuration="%4" />' |
|
763 |
bindWith:compilerName with:compilerVersion |
|
764 |
with:compilerVersionDate with:compilerConfiguration); |
|
765 |
"/ nextPutLine:' <environment />'; |
|
766 |
nextPutLine:' </platform>'; |
|
767 |
nextPutLine:' <result>'; |
|
768 |
nextPutLine:(' <success passed="%1" state="100" />' |
|
769 |
bindWith:successPassed with:successState); |
|
770 |
"/ cg: in the perfPublisher documentation, I found "mesure". |
|
771 |
"/ I am not sure, if that was a typo, or is actually what is expected... |
|
772 |
"/ to be on the save side, I generate both a mesure and a measure attribute, |
|
773 |
"/ so it will work, even if they ever fix perfPublisher's xml parser. |
|
774 |
nextPutLine:(' <executiontime unit="%1" mesure="%2" measure="%2" isRelevant="yes" />' |
|
775 |
bindWith:timeUnit with:timeMeasure). |
|
293 | 776 |
|
734 | 777 |
exceptionInfo notNil ifTrue:[ |
778 |
stream |
|
779 |
nextPutLine:' <errorlog><!![CDATA['; |
|
780 |
nextPutAll:exceptionInfo; |
|
781 |
nextPutLine:']]></errorlog>'. |
|
782 |
]. |
|
293 | 783 |
stream |
734 | 784 |
nextPutLine:' </result>'. |
785 |
]. |
|
298 | 786 |
stream nextPutLine:'</test>'. |
787 |
||
788 |
"Created: / 30-07-2011 / 12:19:03 / cg" |
|
734 | 789 |
"Modified: / 26-03-2019 / 18:37:30 / Claus Gittinger" |
298 | 790 |
! ! |
791 |
||
792 |
!TestResultReporter methodsFor:'reporting - xml-python-unit'! |
|
793 |
||
794 |
reportXml |
|
795 |
"backward compatible: python unit-like XML unittest report format" |
|
796 |
||
797 |
self reportXml_pythonUnit |
|
798 |
||
799 |
"Created: / 30-07-2011 / 11:41:24 / cg" |
|
800 |
! |
|
801 |
||
802 |
reportXml_pythonUnit |
|
803 |
"python unittest-like XML unittest report format" |
|
804 |
||
805 |
stream |
|
806 |
nextPutLine: '<?xml version="1.0"?>'; |
|
807 |
nextPutLine: '<unittest-results>'. |
|
808 |
||
378 | 809 |
result passedOutcomes do:[:each|self reportXml_pythonUnitTest: each result: #success]. |
734 | 810 |
result skippedOutcomes do:[:each|self reportXml_pythonUnitTest: each result: #skipped]. |
378 | 811 |
result failureOutcomes do:[:each|self reportXml_pythonUnitTest: each result: #failure]. |
812 |
result errorOutcomes do:[:each|self reportXml_pythonUnitTest: each result: #error]. |
|
298 | 813 |
|
814 |
stream |
|
815 |
nextPutLine: '</unittest-results>' |
|
816 |
||
817 |
"Created: / 03-08-2011 / 12:56:04 / cg" |
|
734 | 818 |
"Modified: / 26-03-2019 / 18:35:17 / Claus Gittinger" |
298 | 819 |
! |
820 |
||
378 | 821 |
reportXml_pythonUnitTest:testOutcome result: testResult |
298 | 822 |
|
823 |
" |
|
824 |
Example: |
|
825 |
<test |
|
826 |
duration='0.0188629627228' |
|
827 |
status='error' |
|
828 |
fixture='bitten.tests.web_ui.SourceFileLinkFormatterTestCase' |
|
829 |
name='test_format_link_not_in_repos_with_line' |
|
830 |
file='/usr/src/trac-bitten-0.6b2.dfsg/bitten/tests/web_ui.py'> |
|
831 |
" |
|
832 |
||
378 | 833 |
|test testClassName executionTime | |
298 | 834 |
|
378 | 835 |
test := testOutcome testCase. |
298 | 836 |
testClassName := self sunitNameOf: test class. |
837 |
||
838 |
"most tests do not know, and return nil here!!" |
|
378 | 839 |
executionTime := (testOutcome executionTime ? 0.0) printString. |
298 | 840 |
|
841 |
stream |
|
842 |
nextPutAll:'<test duration="'; nextPutAll:executionTime; nextPutLine:'"'; |
|
843 |
tab; nextPutAll:'status="'; nextPutAll: testResult; nextPutLine:'"'; |
|
844 |
tab; nextPutAll:'ficture="'; nextPutAll: testClassName; nextPutLine:'"'; |
|
845 |
tab; nextPutAll:'name="'; nextPutAll: test selector; nextPutLine:'"'; |
|
846 |
"It seems that some tools requires the file attributes. So we supply one :-)" |
|
847 |
tab; nextPutAll:'file="'; nextPutAll: testClassName , '.st'; nextPutLine:'">'. |
|
848 |
||
734 | 849 |
(testResult ~= #success |
850 |
and:[testResult ~= #skipped]) ifTrue:[self reportXml_pythonUnitTraceback: test]. |
|
272
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
851 |
|
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
852 |
stream nextPutLine:'</test>'. |
492c13b42f3b
unfinished perfPublisher support
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
853 |
|
298 | 854 |
"Created: / 03-08-2011 / 12:56:37 / cg" |
734 | 855 |
"Modified: / 26-03-2019 / 18:35:02 / Claus Gittinger" |
298 | 856 |
! |
857 |
||
858 |
reportXml_pythonUnitTraceback: test |
|
859 |
||
860 |
" |
|
861 |
Prints a traceback to the stream. |
|
862 |
This is dialect-specific, so we have to check... |
|
863 |
" |
|
864 |
||
865 |
"Smalltalk/X dialect detection..." |
|
866 |
((Smalltalk respondsTo: #isSmalltalkX) and:[Smalltalk isSmalltalkX]) |
|
867 |
ifTrue:[^self reportXml_pythonUnitTracebackStX: test] |
|
868 |
||
869 |
"Created: / 03-08-2011 / 12:56:54 / cg" |
|
870 |
! |
|
871 |
||
872 |
reportXml_pythonUnitTracebackStX: test |
|
873 |
stream nextPutLine:'<traceback><!![CDATA['. |
|
874 |
||
714 | 875 |
[ |
876 |
test debug |
|
877 |
] on: GenericException do: [:ex| |
|
878 |
HTMLUtilities |
|
879 |
escapeCharacterEntities:(ex suspendedContext fullPrintString) |
|
880 |
on: stream |
|
881 |
]. |
|
298 | 882 |
|
883 |
stream nextPutLine:']]></traceback>'. |
|
884 |
||
885 |
"Modified: / 07-12-2009 / 14:06:48 / Jan Vrany <jan.vrant@fit.cvut.cz>" |
|
886 |
"Created: / 03-08-2011 / 12:57:01 / cg" |
|
714 | 887 |
"Modified: / 21-06-2018 / 07:41:26 / Claus Gittinger" |
222 | 888 |
! ! |
889 |
||
890 |
!TestResultReporter methodsFor:'utilities'! |
|
891 |
||
892 |
sunitNameOf: aClass |
|
893 |
||
894 |
"No all SUnit versions comes with sunitName |
|
895 |
(at least Smalltalk/X 3.1)" |
|
896 |
||
897 |
^(aClass respondsTo:#sunitName) |
|
324 | 898 |
ifTrue:[aClass sunitName] |
899 |
ifFalse:[aClass printString] |
|
222 | 900 |
! ! |
901 |
||
902 |
!TestResultReporter class methodsFor:'documentation'! |
|
903 |
||
904 |
version |
|
680 | 905 |
^ '$Header$' |
268
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
906 |
! |
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
907 |
|
02c41854a7b8
added tap (perl unit test) output format
Claus Gittinger <cg@exept.de>
parents:
267
diff
changeset
|
908 |
version_CVS |
680 | 909 |
^ '$Header$' |
222 | 910 |
! |
911 |
||
912 |
version_SVN |
|
680 | 913 |
^ '$Id$' |
222 | 914 |
! ! |
547 | 915 |