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