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