67
|
1 |
"{ Package: 'stx:goodies/builder/reports' }"
|
|
2 |
|
|
3 |
"{ NameSpace: Builder }"
|
|
4 |
|
|
5 |
ReportFormat subclass:#TestReportFormat
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'Builder-Reports-Formats'
|
|
10 |
!
|
|
11 |
|
|
12 |
TestReportFormat subclass:#JUnit
|
|
13 |
instanceVariableNames:'position failures errors startTime stopTime'
|
|
14 |
classVariableNames:''
|
|
15 |
poolDictionaries:''
|
|
16 |
privateIn:TestReportFormat
|
|
17 |
!
|
|
18 |
|
|
19 |
TestReportFormat subclass:#PerfPublisher
|
|
20 |
instanceVariableNames:''
|
|
21 |
classVariableNames:''
|
|
22 |
poolDictionaries:''
|
|
23 |
privateIn:TestReportFormat
|
|
24 |
!
|
|
25 |
|
|
26 |
TestReportFormat subclass:#PythonUnittest
|
|
27 |
instanceVariableNames:'index'
|
|
28 |
classVariableNames:''
|
|
29 |
poolDictionaries:''
|
|
30 |
privateIn:TestReportFormat
|
|
31 |
!
|
|
32 |
|
|
33 |
TestReportFormat subclass:#TAP
|
|
34 |
instanceVariableNames:'index'
|
|
35 |
classVariableNames:''
|
|
36 |
poolDictionaries:''
|
|
37 |
privateIn:TestReportFormat
|
|
38 |
!
|
|
39 |
|
|
40 |
|
|
41 |
!TestReportFormat class methodsFor:'testing'!
|
|
42 |
|
|
43 |
isAbstract
|
|
44 |
|
|
45 |
^self == TestReportFormat
|
|
46 |
|
|
47 |
"Created: / 04-08-2011 / 11:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
48 |
! !
|
|
49 |
|
|
50 |
!TestReportFormat methodsFor:'accessing - defaults'!
|
|
51 |
|
|
52 |
defaultFileSuffix
|
|
53 |
"superclass HDReportFormat says that I am responsible to implement this method"
|
|
54 |
|
|
55 |
^ 'xml'
|
|
56 |
|
|
57 |
"Modified: / 04-08-2011 / 12:48:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
58 |
! !
|
|
59 |
|
|
60 |
!TestReportFormat methodsFor:'writing'!
|
|
61 |
|
|
62 |
writeTestCase: testcase outcome: outcome time: time exception: exception
|
|
63 |
|
|
64 |
| stacktrace |
|
|
65 |
exception isNil ifTrue:[
|
|
66 |
stacktrace := nil.
|
|
67 |
] ifFalse:[
|
|
68 |
stacktrace :=
|
|
69 |
(String streamContents:[:s|
|
|
70 |
self writeStackTrace: exception of: testcase on: s
|
|
71 |
])
|
|
72 |
].
|
|
73 |
|
|
74 |
^self writeTestCase: testcase outcome: outcome time: time exception: exception
|
|
75 |
stacktrace: stacktrace
|
|
76 |
|
|
77 |
"Created: / 03-08-2011 / 19:44:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
78 |
!
|
|
79 |
|
|
80 |
writeTestCase: testcase outcome: outcome time: time exception: exception stacktrace: stacktrace
|
|
81 |
|
|
82 |
"Write an outcome of a given test.
|
|
83 |
Argumments:
|
|
84 |
testcase....the testcase
|
|
85 |
outcome.....one of #pass, #failure, #error
|
|
86 |
time........time taken to run the test in milliseconds
|
|
87 |
exception...exception that caused error/failure or nil if N/A
|
|
88 |
backtrace...stacktrace info or nil if N/A"
|
|
89 |
|
|
90 |
self subclassResponsibility
|
|
91 |
|
|
92 |
"Created: / 03-08-2011 / 19:43:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
93 |
! !
|
|
94 |
|
|
95 |
!TestReportFormat methodsFor:'writing - utilities'!
|
|
96 |
|
|
97 |
writeContext: context on: s
|
|
98 |
|
|
99 |
|home mthd src|
|
|
100 |
[
|
|
101 |
context printOn: s.
|
|
102 |
s cr.
|
86
|
103 |
s nextPutAll:'receiver: '. context receiver printOn: s. s cr.
|
|
104 |
s nextPutAll:'selector: '. context selector printOn: s. s cr.
|
67
|
105 |
s nextPutAll:'args: '; cr.
|
|
106 |
context args keysAndValuesDo:[:idx :eachArg |
|
86
|
107 |
s nextPutAll:' '. idx printOn: s. s nextPutAll:': '. eachArg printOn: s.s cr.
|
67
|
108 |
].
|
|
109 |
s nextPutAll:'vars: '; cr.
|
|
110 |
context vars keysAndValuesDo:[:idx :eachVar |
|
86
|
111 |
s nextPutAll:' '. idx printOn: s. s nextPutAll:': '. eachVar printOn: s.s cr.
|
67
|
112 |
].
|
|
113 |
s nextPutAll:'source: '; cr.
|
|
114 |
|
|
115 |
[
|
|
116 |
home := context methodHome.
|
|
117 |
mthd := home method.
|
|
118 |
mthd isNil ifTrue:[
|
|
119 |
s nextPutAll: '** no source **'. s cr. s cr.
|
|
120 |
^ self.
|
|
121 |
].
|
|
122 |
src := mthd source.
|
|
123 |
src isNil ifTrue:[
|
|
124 |
s nextPutAll: '** no source **'. s cr. s cr.
|
|
125 |
^ self.
|
|
126 |
].
|
|
127 |
] on: Error do:[:ex|
|
|
128 |
s
|
|
129 |
nextPutAll: '** error when getting source: ';
|
|
130 |
nextPutAll: ex description;
|
|
131 |
nextPutAll: '**';
|
|
132 |
cr; cr.
|
|
133 |
^ self.
|
|
134 |
].
|
|
135 |
src := src asCollectionOfLines.
|
|
136 |
src keysAndValuesDo:[:lNr :line |
|
|
137 |
lNr == context lineNumber ifTrue:[
|
|
138 |
s nextPutAll:'>> '.
|
|
139 |
] ifFalse:[
|
|
140 |
s nextPutAll:' '.
|
|
141 |
].
|
|
142 |
s nextPutAll: line; cr.
|
|
143 |
].
|
|
144 |
s cr.
|
|
145 |
] on: Error do:[:ex|
|
|
146 |
s cr;
|
|
147 |
nextPutAll:'!!!!!!ERROR WHEN GETTING STACK TRACE!!!!!!'; cr;
|
|
148 |
nextPutAll: ex description; cr
|
|
149 |
]
|
|
150 |
|
|
151 |
"Created: / 03-08-2011 / 14:53:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
152 |
!
|
|
153 |
|
|
154 |
writeStackTrace:err of:aTestCase on: str
|
|
155 |
|
|
156 |
|context|
|
|
157 |
|
|
158 |
context := err signalerContext.
|
|
159 |
|
|
160 |
[ context isNil
|
|
161 |
or:[ (context receiver == aTestCase and:[ context selector == #runCase ])
|
|
162 |
or: [ context receiver == self and:[ context selector == #setUp ] ] ] ] whileFalse:
|
|
163 |
[ self writeContext: context on: str.
|
86
|
164 |
str cr; cr.
|
67
|
165 |
context := context sender ]
|
|
166 |
|
|
167 |
"Created: / 03-08-2011 / 14:53:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
168 |
! !
|
|
169 |
|
|
170 |
!TestReportFormat::JUnit class methodsFor:'accessing'!
|
|
171 |
|
|
172 |
symbolicNames
|
|
173 |
^ #( #junit #junit40 )
|
|
174 |
|
|
175 |
"Created: / 04-08-2011 / 11:45:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
176 |
! !
|
|
177 |
|
|
178 |
!TestReportFormat::JUnit class methodsFor:'documentation'!
|
|
179 |
|
|
180 |
version_SVN
|
|
181 |
^ '§Id: Builder__TestReportFormat.st 282 2011-11-07 08:51:43Z vranyj1 §'
|
|
182 |
! !
|
|
183 |
|
|
184 |
!TestReportFormat::JUnit methodsFor:'initialization'!
|
|
185 |
|
|
186 |
initialize
|
|
187 |
|
|
188 |
super initialize.
|
|
189 |
errors := 0.
|
|
190 |
failures := 0.
|
|
191 |
|
|
192 |
"Created: / 03-08-2011 / 15:26:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
193 |
! !
|
|
194 |
|
|
195 |
!TestReportFormat::JUnit methodsFor:'writing'!
|
|
196 |
|
|
197 |
writeFooter
|
|
198 |
stopTime := OperatingSystem getMillisecondTime.
|
|
199 |
stream
|
|
200 |
tab;
|
|
201 |
nextPutAll:'<system-out><!![CDATA[]]></system-out>';
|
|
202 |
nextPut:Character lf.
|
|
203 |
stream
|
|
204 |
tab;
|
|
205 |
nextPutAll:'<system-err><!![CDATA[]]></system-err>';
|
|
206 |
nextPut:Character lf.
|
|
207 |
stream nextPutAll:'</testsuite>'.
|
|
208 |
stream stream position:position.
|
|
209 |
stream
|
|
210 |
nextPutAll:' failures="';
|
|
211 |
print:failures;
|
|
212 |
nextPutAll:'" errors="';
|
|
213 |
print:errors;
|
|
214 |
nextPutAll:'" time="';
|
|
215 |
print:(Time milliseconds:stopTime since:startTime) / 1000.0;
|
|
216 |
nextPutAll:'">'.
|
|
217 |
stream close.
|
|
218 |
|
|
219 |
"Created: / 03-08-2011 / 14:22:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
220 |
!
|
|
221 |
|
|
222 |
writeHeader
|
|
223 |
stream
|
|
224 |
nextPutAll:'<?xml version="1.0" encoding="UTF-8"?>';
|
|
225 |
nextPut:Character lf.
|
|
226 |
stream
|
|
227 |
nextPutAll:'<testsuite name="';
|
|
228 |
nextPutAll:(Report encode:report name);
|
|
229 |
nextPutAll:'" tests="';
|
|
230 |
print:report suite testCount;
|
|
231 |
nextPutAll:'">'.
|
|
232 |
"Now this is ugly. We want to update the time and the number of failures and errors, but still at the same time stream a valid XML. So remember this position and add some whitespace, that we can fill later."
|
|
233 |
position := stream stream position - 1.
|
|
234 |
stream
|
|
235 |
nextPutAll:(String new:100 withAll:$ );
|
|
236 |
nextPut:Character lf.
|
|
237 |
startTime := OperatingSystem getMillisecondTime.
|
|
238 |
|
|
239 |
"Created: / 03-08-2011 / 19:14:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
240 |
!
|
|
241 |
|
|
242 |
writeTestCase:testcase outcome:outcome time:time exception: exception stacktrace:stacktrace
|
|
243 |
|
|
244 |
outcome == #failure ifTrue:[failures := failures + 1].
|
|
245 |
outcome == #error ifTrue:[errors := errors + 1].
|
|
246 |
|
|
247 |
stream tab;
|
|
248 |
nextPutAll: '<testcase classname="';
|
|
249 |
nextPutAll: (self encode: testcase nameForHDTestReport);
|
|
250 |
nextPutAll: '" name="';
|
|
251 |
nextPutAll: (self encode: testcase selectorForHDTestReport);
|
|
252 |
nextPutAll: '" time="'; print: (time ? 0) / 1000.0; nextPutAll: '">'; cr.
|
|
253 |
|
|
254 |
outcome ~~ #pass ifTrue:[
|
|
255 |
| type message |
|
|
256 |
|
|
257 |
exception isNil ifTrue:[
|
|
258 |
type := 'unknown exception'.
|
|
259 |
message := 'unknown exception occured (no exception details available)'
|
|
260 |
] ifFalse:[
|
|
261 |
type := exception class name.
|
|
262 |
message := exception messageText ifNil:[ exception description ].
|
|
263 |
].
|
|
264 |
|
|
265 |
|
|
266 |
stream tab; tab;
|
|
267 |
nextPut:$<; nextPutAll: outcome;
|
|
268 |
nextPutAll:' type="';
|
|
269 |
nextPutAll:(self encode:type);
|
|
270 |
nextPutAll:'" message="';
|
|
271 |
nextPutAll:(self encode: message);
|
86
|
272 |
nextPutAll:'"><!![CDATA['; cr;
|
|
273 |
nextPutAll:(stacktrace ? 'stacktrace not available');
|
|
274 |
nextPutAll:']]></'; nextPutAll: outcome; nextPutAll:'>';
|
67
|
275 |
nextPut:Character lf
|
|
276 |
].
|
|
277 |
stream tab;
|
|
278 |
nextPutAll: '</testcase>'; cr.
|
|
279 |
|
|
280 |
|
|
281 |
stream flush
|
|
282 |
|
|
283 |
"Created: / 03-08-2011 / 19:42:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
284 |
! !
|
|
285 |
|
|
286 |
!TestReportFormat::PerfPublisher class methodsFor:'accessing'!
|
|
287 |
|
|
288 |
symbolicNames
|
|
289 |
"Returns a collection of symbolic names for this format"
|
|
290 |
|
|
291 |
^ #(perfPublisher)
|
|
292 |
|
|
293 |
"Modified: / 04-08-2011 / 11:52:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
294 |
! !
|
|
295 |
|
|
296 |
!TestReportFormat::PerfPublisher class methodsFor:'documentation'!
|
|
297 |
|
|
298 |
version_SVN
|
|
299 |
^ '§Id: Builder__TestReportFormat.st 282 2011-11-07 08:51:43Z vranyj1 §'
|
|
300 |
! !
|
|
301 |
|
|
302 |
!TestReportFormat::PerfPublisher methodsFor:'writing'!
|
|
303 |
|
|
304 |
writeFooter
|
|
305 |
|
|
306 |
stream nextPutLine: '</report>'
|
|
307 |
|
|
308 |
"Modified: / 03-08-2011 / 20:12:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
309 |
!
|
|
310 |
|
|
311 |
writeHeader
|
|
312 |
|
|
313 |
|reportName reportCategory testClass|
|
|
314 |
|
|
315 |
reportName := report suite name.
|
|
316 |
reportCategory := 'uncategorized'. "/ it is a required attribute; so what should we use ?
|
|
317 |
|
|
318 |
(testClass := Smalltalk at:reportName asSymbol) isBehavior ifTrue:[
|
|
319 |
reportCategory := testClass category. "/ at least, something to show
|
|
320 |
].
|
|
321 |
|
|
322 |
stream
|
|
323 |
nextPutLine: '<?xml version="1.0"?>';
|
|
324 |
nextPutLine:('<report name="%1" categ="%2">' bindWith:reportName with:reportCategory);
|
|
325 |
nextPutLine:(' <start>');
|
|
326 |
nextPutLine:(' <date format="YYYYMMDD" val="%1" />' bindWith:(Date today printStringFormat:'%y%m%d'));
|
|
327 |
nextPutLine:(' <time format="HHMMSS" val="%1" />' bindWith:(Time now printStringFormat:'%h%m%s'));
|
|
328 |
nextPutLine:(' </start>').
|
|
329 |
|
|
330 |
"Modified: / 03-08-2011 / 20:12:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
331 |
!
|
|
332 |
|
|
333 |
writeTestCase:testcase outcome:outcome time:time exception:exception stacktrace:stacktrace
|
|
334 |
|
|
335 |
"
|
|
336 |
Example:
|
|
337 |
<test
|
|
338 |
name='test_format_link_not_in_repos_with_line'
|
|
339 |
executed='exec-status'
|
|
340 |
<result>
|
|
341 |
<success passed='result-status' state='result-state'/>
|
|
342 |
<errorlog><!![CDATA[EXEMPLE OF ERROR LOG]]></errorlog>
|
|
343 |
</result>
|
|
344 |
</test>
|
|
345 |
"
|
|
346 |
|
|
347 |
|testClassName executionTime testName testDescription
|
|
348 |
successPassed successState exceptionInfo
|
|
349 |
compilerName compilerVersion compilerConfiguration compilerVersionDate
|
|
350 |
timeUnit timeMeasure
|
|
351 |
sysInfo osType osVersion cpuType|
|
|
352 |
|
|
353 |
testClassName := testcase printString.
|
|
354 |
testName := testcase selector.
|
|
355 |
|
|
356 |
"most tests do not know, and return nil here!!"
|
|
357 |
executionTime := time. "/ millis
|
|
358 |
testDescription := '%1-%2' bindWith:testClassName with:testName.
|
|
359 |
|
|
360 |
successPassed := (outcome == #pass) ifTrue:['yes'] ifFalse:['no'].
|
|
361 |
outcome ~~ #pass ifTrue:[
|
|
362 |
exceptionInfo := stacktrace ? 'No stacktrace available'.
|
|
363 |
].
|
|
364 |
|
|
365 |
successState := 'foo'.
|
|
366 |
|
|
367 |
"/ caveat: the following needs to be made dialect-specific
|
|
368 |
compilerName := 'Smalltalk/X'.
|
|
369 |
compilerVersion := Smalltalk versionString.
|
|
370 |
compilerConfiguration := Smalltalk configuration.
|
|
371 |
compilerVersionDate := Smalltalk versionDate.
|
|
372 |
|
|
373 |
sysInfo := OperatingSystem getSystemInfo.
|
|
374 |
osType := (sysInfo at:#osType ifAbsent:'?').
|
|
375 |
osVersion := (sysInfo at:#release ifAbsent:'?').
|
|
376 |
|
|
377 |
cpuType := (sysInfo at:#cpuType ifAbsent:'?').
|
|
378 |
"/ cpuSpeed := (sysInfo at:#cpuSpeed ifAbsent:'?').
|
|
379 |
|
|
380 |
timeUnit := 'ms'.
|
|
381 |
timeMeasure := executionTime.
|
|
382 |
|
|
383 |
stream
|
|
384 |
nextPutLine:('<test name="%1" executed="yes">' bindWith: testName);
|
|
385 |
nextPutLine:(' <description><!![CDATA[%1]]></description>' bindWith: testDescription);
|
|
386 |
nextPutLine:' <platform>';
|
|
387 |
nextPutLine:' <os>';
|
|
388 |
nextPutLine:(' <type><!![CDATA[%1]]></type>' bindWith:osType);
|
|
389 |
nextPutLine:(' <version><!![CDATA[%1]]></version>' bindWith:osVersion);
|
|
390 |
nextPutLine:' </os>';
|
|
391 |
nextPutLine:(' <processor arch="%1">' bindWith:cpuType);
|
|
392 |
"/ nextPutLine:(' <frequency> unit="Mhz" cpufreq="%1" />' bindWith:cpuSpeed);
|
|
393 |
nextPutLine:' </processor>';
|
|
394 |
nextPutLine:(' <compiler name="%1" version="%2" versiondate="%3" configuration="%4" />'
|
|
395 |
bindWith:compilerName with:compilerVersion
|
|
396 |
with:compilerVersionDate with:compilerConfiguration);
|
|
397 |
"/ nextPutLine:' <environment />';
|
|
398 |
nextPutLine:' </platform>';
|
|
399 |
nextPutLine:' <result>';
|
|
400 |
nextPutLine:(' <success passed="%1" state="100" />'
|
|
401 |
bindWith:successPassed with:successState);
|
|
402 |
"/ cg: in the perfPublisher documentation, I found "mesure".
|
|
403 |
"/ I am not sure, if that was a typo, or is actually what is expected...
|
|
404 |
"/ to be on the save side, I generate both a mesure and a measure attribute,
|
|
405 |
"/ so it will work, even if they ever fix perfPublisher's xml parser.
|
|
406 |
nextPutLine:(' <executiontime unit="%1" mesure="%2" measure="%2" isRelevant="yes" />'
|
|
407 |
bindWith:timeUnit with:timeMeasure).
|
|
408 |
|
|
409 |
exceptionInfo notNil ifTrue:[
|
|
410 |
stream
|
|
411 |
nextPutLine:' <errorlog><!![CDATA[';
|
|
412 |
nextPutAll:exceptionInfo;
|
|
413 |
nextPutLine:']]></errorlog>'.
|
|
414 |
].
|
|
415 |
stream
|
|
416 |
nextPutLine:' </result>'.
|
|
417 |
|
|
418 |
stream nextPutLine:'</test>'.
|
|
419 |
|
|
420 |
"Modified: / 03-08-2011 / 20:15:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
421 |
! !
|
|
422 |
|
|
423 |
!TestReportFormat::PythonUnittest class methodsFor:'accessing'!
|
|
424 |
|
|
425 |
symbolicNames
|
|
426 |
"Returns a collection of symbolic names for this format"
|
|
427 |
|
|
428 |
^ #(python python-unittest)
|
|
429 |
|
|
430 |
"Modified: / 04-08-2011 / 11:52:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
431 |
! !
|
|
432 |
|
|
433 |
!TestReportFormat::PythonUnittest class methodsFor:'documentation'!
|
|
434 |
|
|
435 |
version_SVN
|
|
436 |
^ '§Id: Builder__TestReportFormat.st 282 2011-11-07 08:51:43Z vranyj1 §'
|
|
437 |
! !
|
|
438 |
|
|
439 |
!TestReportFormat::PythonUnittest methodsFor:'writing'!
|
|
440 |
|
|
441 |
writeFooter
|
|
442 |
|
|
443 |
stream
|
|
444 |
nextPutLine: '</unittest-results>'
|
|
445 |
|
|
446 |
"Modified: / 03-08-2011 / 20:19:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
447 |
!
|
|
448 |
|
|
449 |
writeHeader
|
|
450 |
|
|
451 |
stream
|
|
452 |
nextPutLine: '<?xml version="1.0"?>';
|
|
453 |
nextPutLine: '<unittest-results>'.
|
|
454 |
|
|
455 |
"Modified: / 03-08-2011 / 20:19:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
456 |
!
|
|
457 |
|
|
458 |
writeTestCase:testcase outcome:outcome time:time exception:exception stacktrace:stacktrace
|
|
459 |
|
|
460 |
"
|
|
461 |
Example:
|
|
462 |
<test
|
|
463 |
duration='0.0188629627228'
|
|
464 |
status='error'
|
|
465 |
fixture='bitten.tests.web_ui.SourceFileLinkFormatterTestCase'
|
|
466 |
name='test_format_link_not_in_repos_with_line'
|
|
467 |
file='/usr/src/trac-bitten-0.6b2.dfsg/bitten/tests/web_ui.py'>
|
|
468 |
"
|
|
469 |
|
|
470 |
| testClassName status |
|
|
471 |
|
|
472 |
testClassName := testcase class printString.
|
|
473 |
|
|
474 |
status := outcome == #pass ifTrue:[#success] ifFalse:[outcome].
|
|
475 |
|
|
476 |
stream
|
|
477 |
nextPutAll:'<test duration="'; nextPutAll:time; nextPutLine:'"';
|
|
478 |
tab; nextPutAll:'status="'; nextPutAll: status; nextPutLine:'"';
|
|
479 |
tab; nextPutAll:'ficture="'; nextPutAll: testClassName; nextPutLine:'"';
|
|
480 |
tab; nextPutAll:'name="'; nextPutAll: testcase selector; nextPutLine:'"';
|
|
481 |
"It seems that some tools requires the file attributes. So we supply one :-)"
|
|
482 |
tab; nextPutAll:'file="'; nextPutAll: testClassName , '.st'; nextPutLine:'">'.
|
|
483 |
|
|
484 |
outcome == #pass ifFalse:[
|
|
485 |
stream nextPutLine:'<traceback><!![CDATA['.
|
|
486 |
stream nextPutAll: stacktrace ? 'No stacktrace available'.
|
|
487 |
stream nextPutLine:']]></traceback>'.
|
|
488 |
].
|
|
489 |
|
|
490 |
stream nextPutLine:'</test>'.
|
|
491 |
|
|
492 |
"Modified: / 03-08-2011 / 20:23:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
493 |
! !
|
|
494 |
|
|
495 |
!TestReportFormat::TAP class methodsFor:'accessing'!
|
|
496 |
|
|
497 |
symbolicNames
|
|
498 |
"Returns a collection of symbolic names for this format"
|
|
499 |
|
|
500 |
^ #(tap TAP)
|
|
501 |
|
|
502 |
"Modified: / 04-08-2011 / 11:52:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
503 |
! !
|
|
504 |
|
|
505 |
!TestReportFormat::TAP class methodsFor:'documentation'!
|
|
506 |
|
|
507 |
version_SVN
|
|
508 |
^ '§Id: Builder__TestReportFormat.st 282 2011-11-07 08:51:43Z vranyj1 §'
|
|
509 |
! !
|
|
510 |
|
|
511 |
!TestReportFormat::TAP methodsFor:'accessing - defaults'!
|
|
512 |
|
|
513 |
defaultFileSuffix
|
|
514 |
"superclass HDReportFormat says that I am responsible to implement this method"
|
|
515 |
|
|
516 |
^ 'tap'
|
|
517 |
|
|
518 |
"Modified: / 04-08-2011 / 12:47:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
519 |
! !
|
|
520 |
|
|
521 |
!TestReportFormat::TAP methodsFor:'writing'!
|
|
522 |
|
|
523 |
writeFooter
|
|
524 |
|
|
525 |
"nothing to do"
|
|
526 |
|
|
527 |
"Modified: / 03-08-2011 / 20:05:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
528 |
!
|
|
529 |
|
|
530 |
writeHeader
|
|
531 |
|
|
532 |
stream nextPutAll: '1..'; nextPutAll: report suite testCount printString; cr.
|
|
533 |
index := 0
|
|
534 |
|
|
535 |
"Modified: / 04-08-2011 / 13:49:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
536 |
!
|
|
537 |
|
|
538 |
writeTestCase:testcase outcome:outcome time:time exception:exception stacktrace:stacktrace
|
|
539 |
|
|
540 |
| testDescription statusString|
|
|
541 |
|
|
542 |
index := index + 1.
|
|
543 |
|
|
544 |
testDescription := '%1-%2 (%3ms)'
|
|
545 |
bindWith:testcase printString
|
|
546 |
with:testcase selector
|
|
547 |
with:time.
|
|
548 |
|
|
549 |
statusString := (outcome == #pass)
|
|
550 |
ifTrue:['ok']
|
|
551 |
ifFalse:['not ok'].
|
|
552 |
|
|
553 |
stream nextPutLine:('%1 %2 - %3'
|
|
554 |
bindWith:statusString
|
|
555 |
with:index
|
|
556 |
with:testDescription).
|
|
557 |
|
|
558 |
"Modified: / 03-08-2011 / 20:08:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
559 |
! !
|
|
560 |
|
|
561 |
!TestReportFormat class methodsFor:'documentation'!
|
|
562 |
|
|
563 |
version
|
|
564 |
^ '$Header$'
|
|
565 |
!
|
|
566 |
|
|
567 |
version_CVS
|
|
568 |
^ '$Header$'
|
|
569 |
!
|
|
570 |
|
|
571 |
version_SVN
|
|
572 |
^ '§Id: Builder__TestReportFormat.st 282 2011-11-07 08:51:43Z vranyj1 §'
|
|
573 |
! !
|