author | Claus Gittinger <cg@exept.de> |
Sun, 01 Jul 2018 12:52:19 +0200 | |
changeset 719 | 2c96860ad5cb |
parent 698 | 59624ffe90ed |
child 725 | 812dd23c3e33 |
permissions | -rw-r--r-- |
698 | 1 |
"{ Encoding: utf8 }" |
2 |
||
0 | 3 |
"{ Package: 'stx:goodies/sunit' }" |
4 |
||
640 | 5 |
"{ NameSpace: Smalltalk }" |
6 |
||
0 | 7 |
ApplicationModel subclass:#TestRunner |
64 | 8 |
instanceVariableNames:'result lastTestCase lastPass defect allDefects defectMenu details |
9 |
mode scriptModel script numberOfTestsToRun testsWhichFailed |
|
39 | 10 |
testsWhichPassed categoryModel category' |
30 | 11 |
classVariableNames:'' |
12 |
poolDictionaries:'' |
|
13 |
category:'SUnit-UI' |
|
0 | 14 |
! |
15 |
||
43 | 16 |
!TestRunner class methodsFor:'documentation'! |
17 |
||
18 |
documentation |
|
19 |
" |
|
697 | 20 |
Obsolete now; see the enhanced test runner: Tools::TestRunner2 |
21 |
||
222 | 22 |
This GUI is based on SUnit2.7 and |
43 | 23 |
was ported to ST/X by Samuel S. Schuster (as 2.7) (thanks, indeed) |
24 |
||
25 |
It was slightly enhanced by adding a rerun-defects, browse and |
|
26 |
a category selector (to minor revision 2.7d, in the meantime) |
|
222 | 27 |
" |
43 | 28 |
! ! |
11 | 29 |
|
8 | 30 |
!TestRunner class methodsFor:'defaults'! |
31 |
||
42 | 32 |
colorForFailedTests |
33 |
^ Color red |
|
34 |
! |
|
35 |
||
36 |
colorForPassedTests |
|
37 |
^ Color green darkened |
|
38 |
! |
|
39 |
||
8 | 40 |
defaultIcon |
78 | 41 |
<resource: #programImage> |
8 | 42 |
|
78 | 43 |
"/ kept there to prevent me from being autoloaded for the icon |
528 | 44 |
^ ToolbarIconLibrary sUnit24x24Icon |
8 | 45 |
! ! |
46 |
||
0 | 47 |
!TestRunner class methodsFor:'interface specs'! |
48 |
||
698 | 49 |
helpSpec |
48 | 50 |
<resource: #help> |
51 |
||
698 | 52 |
^super helpSpec addPairsFrom:#( |
48 | 53 |
|
54 |
#refreshSuitesButton |
|
55 |
'Refresh List of Tests' |
|
56 |
||
57 |
#suitesCategoryList |
|
58 |
'Test Categories' |
|
59 |
||
60 |
#suiteSelection |
|
61 |
'Selected Test' |
|
62 |
||
63 |
#runButton |
|
64 |
'Run selected Test' |
|
65 |
||
66 |
#rerunDefectsButton |
|
67 |
'ReRun Defects Only' |
|
68 |
||
69 |
#runAllButton |
|
70 |
'Run all Tests from Category' |
|
71 |
||
72 |
#defectsList |
|
73 |
'Failures' |
|
74 |
||
75 |
#browseButton |
|
76 |
'Browse Test' |
|
77 |
||
78 |
#debugButton |
|
79 |
'Debug Failed Test' |
|
80 |
||
81 |
) |
|
82 |
! |
|
83 |
||
0 | 84 |
windowSpec |
85 |
"This resource specification was automatically generated |
|
86 |
by the UIPainter of ST/X." |
|
87 |
||
88 |
"Do not manually edit this!! If it is corrupted, |
|
89 |
the UIPainter may not be able to read the specification." |
|
90 |
||
91 |
" |
|
92 |
UIPainter new openOnClass:TestRunner andSelector:#windowSpec |
|
93 |
TestRunner new openInterface:#windowSpec |
|
94 |
TestRunner open |
|
95 |
" |
|
96 |
||
97 |
<resource: #canvas> |
|
98 |
||
222 | 99 |
^ |
117
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
100 |
#(FullSpec |
222 | 101 |
name: windowSpec |
102 |
window: |
|
117
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
103 |
(WindowSpec |
222 | 104 |
label: 'SUnit Camp Smalltalk 3.1/STX TestRunner' |
105 |
name: 'SUnit Camp Smalltalk 3.1/STX TestRunner' |
|
106 |
min: (Point 362 122) |
|
107 |
bounds: (Rectangle 0 0 493 175) |
|
108 |
icon: defaultIcon |
|
109 |
) |
|
110 |
component: |
|
117
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
111 |
(SpecCollection |
222 | 112 |
collection: ( |
113 |
(ActionButtonSpec |
|
114 |
label: 'Refresh' |
|
115 |
name: 'RefreshButton' |
|
116 |
layout: (LayoutFrame 0 0 0 0 75 0 48 0) |
|
117 |
activeHelpKey: refreshSuitesButton |
|
118 |
tabable: true |
|
119 |
model: refreshSuites |
|
120 |
) |
|
121 |
(MenuButtonSpec |
|
122 |
name: 'category' |
|
123 |
layout: (LayoutFrame 76 0 0 0 -216 1 24 0) |
|
124 |
activeHelpKey: suitesCategoryList |
|
125 |
tabable: true |
|
126 |
model: category |
|
127 |
menu: categoryList |
|
128 |
) |
|
129 |
(MenuButtonSpec |
|
130 |
name: tests |
|
131 |
layout: (LayoutFrame 76 0 24 0 -216 1 48 0) |
|
132 |
activeHelpKey: suiteSelection |
|
133 |
tabable: true |
|
134 |
model: script |
|
135 |
menu: scriptModel |
|
136 |
useIndex: true |
|
137 |
) |
|
138 |
(ActionButtonSpec |
|
139 |
label: 'Run' |
|
140 |
name: 'RunButton' |
|
141 |
layout: (LayoutFrame -215 1 0 0 -160 1 48 0) |
|
142 |
activeHelpKey: runButton |
|
143 |
tabable: true |
|
144 |
model: runTests |
|
145 |
enableChannel: enableRunButton |
|
146 |
) |
|
147 |
(ActionButtonSpec |
|
148 |
label: 'ReRun Defects' |
|
149 |
name: 'ReRunButton' |
|
150 |
layout: (LayoutFrame -159 1 0 0 -57 1 48 0) |
|
151 |
activeHelpKey: rerunDefectsButton |
|
152 |
tabable: true |
|
153 |
model: runDefects |
|
154 |
enableChannel: enableDefects |
|
155 |
) |
|
156 |
(ActionButtonSpec |
|
157 |
label: 'Run All' |
|
158 |
name: 'RunAllButton' |
|
159 |
layout: (LayoutFrame -56 1 0 0 0 1 48 0) |
|
160 |
activeHelpKey: runAllButton |
|
161 |
tabable: true |
|
162 |
model: runAllTests |
|
163 |
) |
|
164 |
(ProgressIndicatorSpec |
|
165 |
name: 'ProgressIndicator1' |
|
166 |
layout: (LayoutFrame 0 0.0 49 0 0 1.0 60 0) |
|
167 |
visibilityChannel: percentageIndicatorVisible |
|
168 |
model: percentageDone |
|
169 |
foregroundColor: (Color 32.999160753796 32.999160753796 0.0) |
|
170 |
backgroundColor: (Color 66.999313344015 66.999313344015 0.0) |
|
171 |
showPercentage: false |
|
172 |
) |
|
173 |
(LabelSpec |
|
174 |
label: '...' |
|
175 |
name: 'details' |
|
176 |
layout: (LayoutFrame 0 0 21 0.5 0 1 -25 1) |
|
177 |
labelChannel: details |
|
178 |
) |
|
179 |
(LabelSpec |
|
180 |
label: 'N/A' |
|
181 |
name: 'mode' |
|
182 |
layout: (LayoutFrame 0 0 49 0 0 1 35 0.5) |
|
183 |
style: (FontDescription Arial bold roman 14) |
|
184 |
labelChannel: mode |
|
185 |
) |
|
186 |
(MenuButtonSpec |
|
187 |
name: defects |
|
188 |
layout: (LayoutFrame 0 0 -24 1 -152 1 0 1) |
|
189 |
isOpaque: true |
|
190 |
flags: 40 |
|
191 |
activeHelpKey: defectsList |
|
192 |
tabable: true |
|
193 |
model: selectionHolder |
|
194 |
initiallyDisabled: true |
|
195 |
enableChannel: enableDefects |
|
196 |
menu: defectMenu |
|
197 |
ignoreReselect: false |
|
198 |
) |
|
199 |
(ActionButtonSpec |
|
200 |
label: 'Browse' |
|
201 |
name: 'BrowseButton' |
|
202 |
layout: (LayoutFrame -151 1 -24 1 -76 1 0 1) |
|
203 |
activeHelpKey: browseButton |
|
204 |
tabable: true |
|
205 |
model: browseSelectedTestCase |
|
206 |
initiallyDisabled: true |
|
207 |
enableChannel: enableRunButton |
|
208 |
) |
|
209 |
(ActionButtonSpec |
|
210 |
label: 'Debug' |
|
211 |
name: 'DebugButton' |
|
212 |
layout: (LayoutFrame -75 1 -24 1 0 1 0 1) |
|
213 |
activeHelpKey: debugButton |
|
214 |
tabable: true |
|
215 |
model: debugSelectedFailure |
|
216 |
initiallyDisabled: true |
|
217 |
enableChannel: enableDebugButton |
|
218 |
) |
|
219 |
) |
|
220 |
||
221 |
) |
|
0 | 222 |
) |
223 |
! ! |
|
224 |
||
225 |
!TestRunner class methodsFor:'opening'! |
|
226 |
||
227 |
open |
|
228 |
||
30 | 229 |
^super open |
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
230 |
! |
5 | 231 |
|
232 |
openOnTestCase:aTestCaseSubclass |
|
76
4caa8b4f31d1
immediately run tests when started on a specified testCase
Claus Gittinger <cg@exept.de>
parents:
75
diff
changeset
|
233 |
"open the testrunner,let it switch to and execute a testcase" |
4caa8b4f31d1
immediately run tests when started on a specified testCase
Claus Gittinger <cg@exept.de>
parents:
75
diff
changeset
|
234 |
|
106 | 235 |
|runner| |
5 | 236 |
|
237 |
runner := self new. |
|
76
4caa8b4f31d1
immediately run tests when started on a specified testCase
Claus Gittinger <cg@exept.de>
parents:
75
diff
changeset
|
238 |
runner openAndWaitUntilVisible. |
4caa8b4f31d1
immediately run tests when started on a specified testCase
Claus Gittinger <cg@exept.de>
parents:
75
diff
changeset
|
239 |
|
4caa8b4f31d1
immediately run tests when started on a specified testCase
Claus Gittinger <cg@exept.de>
parents:
75
diff
changeset
|
240 |
"/ idx := runner scriptModel value indexOf:aTestCaseSubclass name. |
4caa8b4f31d1
immediately run tests when started on a specified testCase
Claus Gittinger <cg@exept.de>
parents:
75
diff
changeset
|
241 |
runner selectScriptNamed:aTestCaseSubclass name. |
15 | 242 |
|
76
4caa8b4f31d1
immediately run tests when started on a specified testCase
Claus Gittinger <cg@exept.de>
parents:
75
diff
changeset
|
243 |
"/ the test should be executed by the TestRunner process (not the caller) |
4caa8b4f31d1
immediately run tests when started on a specified testCase
Claus Gittinger <cg@exept.de>
parents:
75
diff
changeset
|
244 |
"/ in oder for CTRL-C and busyCursor to work correctly. |
4caa8b4f31d1
immediately run tests when started on a specified testCase
Claus Gittinger <cg@exept.de>
parents:
75
diff
changeset
|
245 |
"/ Therefore, push event instead of executing the test here. |
4caa8b4f31d1
immediately run tests when started on a specified testCase
Claus Gittinger <cg@exept.de>
parents:
75
diff
changeset
|
246 |
|
222 | 247 |
"/runner runTests |
182 | 248 |
runner enqueueMessage:#runTests for:runner arguments:#(). |
5 | 249 |
|
250 |
" |
|
251 |
self openOnTestCase:CompilerTest |
|
76
4caa8b4f31d1
immediately run tests when started on a specified testCase
Claus Gittinger <cg@exept.de>
parents:
75
diff
changeset
|
252 |
self openOnTestCase:ConstraintTests |
5 | 253 |
" |
254 |
! ! |
|
0 | 255 |
|
256 |
!TestRunner class methodsFor:'plugIn spec'! |
|
257 |
||
258 |
aspectSelectors |
|
259 |
"This resource specification was automatically generated |
|
260 |
by the UIPainter of ST/X." |
|
261 |
||
262 |
"Do not manually edit this. If it is corrupted, |
|
263 |
the UIPainter may not be able to read the specification." |
|
264 |
||
265 |
"Return a description of exported aspects; |
|
266 |
these can be connected to aspects of an embedding application |
|
267 |
(if this app is embedded in a subCanvas)." |
|
268 |
||
269 |
^ #( |
|
222 | 270 |
#script |
0 | 271 |
). |
272 |
||
273 |
! ! |
|
274 |
||
68 | 275 |
!TestRunner methodsFor:'accessing'! |
0 | 276 |
|
39 | 277 |
category |
278 |
|holder| |
|
279 |
||
280 |
(holder := builder bindingAt:#category) isNil ifTrue:[ |
|
222 | 281 |
holder := '* all *' asValue. |
282 |
builder aspectAt:#category put:holder. |
|
283 |
holder onChangeSend:#categorySelectionChanged to:self. |
|
39 | 284 |
]. |
285 |
^ holder. |
|
286 |
! |
|
287 |
||
288 |
categoryList |
|
222 | 289 |
^categoryModel isNil |
290 |
ifTrue: [categoryModel := ValueHolder new. self updateCategoryList. categoryModel] |
|
291 |
ifFalse: [categoryModel] |
|
39 | 292 |
! |
293 |
||
0 | 294 |
defectMenu |
640 | 295 |
^ defectMenu isNil |
296 |
ifTrue: [defectMenu := OrderedCollection new asValue] |
|
297 |
ifFalse: [defectMenu] |
|
0 | 298 |
|
299 |
"Modified: / 4.4.2000 / 20:00:31 / Sames" |
|
300 |
! |
|
301 |
||
302 |
defects |
|
303 |
||
30 | 304 |
^self builder componentAt: #defects |
0 | 305 |
|
306 |
"Created: / 21.6.2000 / 12:19:29 / Sames" |
|
307 |
! |
|
308 |
||
309 |
details |
|
106 | 310 |
"This method was generated by UIDefiner. Any edits made here |
311 |
may be lost whenever methods are automatically defined. The |
|
312 |
initialization provided below may have been preempted by an |
|
313 |
initialize method." |
|
0 | 314 |
|
106 | 315 |
^details isNil |
316 |
ifTrue: |
|
317 |
[details := '...' asValue] |
|
318 |
ifFalse: |
|
319 |
[details] |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
320 |
! |
0 | 321 |
|
322 |
mode |
|
30 | 323 |
"This method was generated by UIDefiner. Any edits made here |
324 |
may be lost whenever methods are automatically defined. The |
|
325 |
initialization provided below may have been preempted by an |
|
326 |
initialize method." |
|
0 | 327 |
|
30 | 328 |
^mode isNil |
329 |
ifTrue: |
|
330 |
[mode := 'N/A' asValue] |
|
331 |
ifFalse: |
|
332 |
[mode] |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
333 |
! |
0 | 334 |
|
19 | 335 |
percentageDone |
178 | 336 |
^ builder valueAspectFor:#percentageDone initialValue:0 |
19 | 337 |
! |
338 |
||
339 |
percentageIndicatorVisible |
|
178 | 340 |
^ builder valueAspectFor:#percentageIndicatorVisible initialValue:false |
19 | 341 |
! |
342 |
||
0 | 343 |
script |
344 |
"automatically generated by UIPainter ..." |
|
345 |
||
640 | 346 |
<resource: #uiAspect> |
0 | 347 |
|
55 | 348 |
script isNil ifTrue:[ |
640 | 349 |
script := ValueHolder new. |
350 |
script onChangeSend:#suiteSelectionChanged to:self. |
|
0 | 351 |
]. |
55 | 352 |
^ script. |
0 | 353 |
|
354 |
"Created: / 21.6.2000 / 12:04:36 / Sames" |
|
355 |
! |
|
356 |
||
357 |
script:something |
|
358 |
builder aspectAt:#script put:something. |
|
359 |
||
360 |
"Created: / 21.6.2000 / 12:04:36 / Sames" |
|
361 |
! |
|
362 |
||
363 |
scriptModel |
|
364 |
"This method was generated by UIDefiner. Any edits made here |
|
222 | 365 |
may be lost whenever methods are automatically defined. The |
366 |
initialization provided below may have been preempted by an |
|
367 |
initialize method." |
|
0 | 368 |
|
222 | 369 |
^scriptModel isNil |
370 |
ifTrue: [scriptModel := ValueHolder new. self updateSuitesList. scriptModel] |
|
371 |
ifFalse: [scriptModel] |
|
0 | 372 |
|
373 |
"Modified: / 2.4.2000 / 14:37:51 / Sames" |
|
374 |
! |
|
375 |
||
376 |
selection |
|
377 |
||
30 | 378 |
^defect |
0 | 379 |
|
380 |
"Created: / 4.4.2000 / 18:50:55 / Sames" |
|
381 |
! |
|
382 |
||
383 |
selectionHolder |
|
384 |
||
385 |
|holder| |
|
386 |
||
387 |
(holder := builder bindingAt:#selectionHolder) isNil ifTrue:[ |
|
222 | 388 |
holder := AspectAdaptor new subject:self; forAspect:#selection. |
389 |
builder aspectAt:#selectionHolder put:holder. |
|
0 | 390 |
]. |
391 |
^ holder. |
|
392 |
||
393 |
"Created: / 4.4.2000 / 18:46:08 / Sames" |
|
394 |
"Modified: / 4.4.2000 / 18:47:31 / Sames" |
|
395 |
! |
|
396 |
||
397 |
tests |
|
398 |
||
30 | 399 |
^self builder componentAt: #tests |
0 | 400 |
|
401 |
"Created: / 4.4.2000 / 19:57:37 / Sames" |
|
402 |
! ! |
|
403 |
||
68 | 404 |
!TestRunner methodsFor:'actions'! |
0 | 405 |
|
10 | 406 |
browseSelectedTestCase |
75 | 407 |
|testCaseName testCase browser defect singleCase| |
10 | 408 |
|
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
409 |
testCaseName := self selectedScript. |
115 | 410 |
testCaseName isNil ifTrue:[ |
640 | 411 |
testCaseName := self tests contents. |
412 |
testCaseName notNil ifTrue:[ |
|
413 |
testCaseName := testCaseName string |
|
414 |
] |
|
115 | 415 |
]. |
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
416 |
testCaseName notNil ifTrue:[ |
640 | 417 |
testCase := Smalltalk at:testCaseName asSymbol. |
418 |
testCase notNil ifTrue:[ |
|
419 |
browser := testCase browserClass openInClass:testCase. |
|
420 |
MessageNotUnderstood |
|
421 |
handle:[:ex | ] |
|
422 |
do:[ |
|
423 |
(defect := self selection) notNil ifTrue:[ |
|
424 |
singleCase := allDefects at:defect ifAbsent: [nil]. |
|
425 |
]. |
|
426 |
singleCase notNil ifTrue:[ |
|
427 |
browser switchToSelector:singleCase selector |
|
428 |
] ifFalse:[ |
|
429 |
browser selectProtocolsMatching:'test*' |
|
430 |
] |
|
431 |
] |
|
432 |
] |
|
10 | 433 |
] |
434 |
! |
|
435 |
||
39 | 436 |
categorySelectionChanged |
222 | 437 |
|selectedScriptIndex selectedScript oldSuitesList newSuitesList |
60 | 438 |
newScriptSelectionIndex| |
55 | 439 |
|
440 |
selectedScriptIndex := self script value. |
|
441 |
oldSuitesList := self scriptModel value. |
|
442 |
||
206 | 443 |
(selectedScriptIndex notNil and:[selectedScriptIndex ~~0]) ifTrue:[ |
222 | 444 |
selectedScript := (oldSuitesList at:selectedScriptIndex) string |
55 | 445 |
]. |
446 |
||
447 |
self updateSuitesList. |
|
448 |
||
449 |
newSuitesList := self scriptModel value. |
|
60 | 450 |
newScriptSelectionIndex := newSuitesList indexOf:selectedScript. |
451 |
||
222 | 452 |
self script value:(newScriptSelectionIndex == 0 |
453 |
ifTrue:[nil] |
|
454 |
ifFalse:[newScriptSelectionIndex]). |
|
39 | 455 |
! |
456 |
||
0 | 457 |
debugSelectedFailure |
106 | 458 |
self debugTest: self selection |
0 | 459 |
|
460 |
"Created: / 21.6.2000 / 10:58:58 / Sames" |
|
461 |
"Modified: / 21.6.2000 / 12:21:05 / Sames" |
|
462 |
! |
|
463 |
||
222 | 464 |
debugTest: aTestCaseName |
0 | 465 |
| testCase | |
29
ada4e34e33ec
allow reselecting in defect-popUpList
Claus Gittinger <cg@exept.de>
parents:
28
diff
changeset
|
466 |
|
0 | 467 |
defect := aTestCaseName. |
468 |
testCase := allDefects at: aTestCaseName ifAbsent: [nil]. |
|
469 |
testCase isNil ifTrue: [^self enableDebugButton value: false]. |
|
75 | 470 |
|
0 | 471 |
self enableDebugButton value: true. |
472 |
self displayMode: 'Debugging'. |
|
473 |
||
75 | 474 |
"/ defect := nil. |
475 |
||
99 | 476 |
self withWaitCursorDo:[ |
222 | 477 |
((result isFailure: testCase) "or:[(result isError: testCase)]") |
478 |
ifTrue: [testCase debugAsFailure] |
|
479 |
ifFalse: [testCase debug]. |
|
99 | 480 |
]. |
75 | 481 |
|
0 | 482 |
"Modified: / 21.6.2000 / 12:12:09 / Sames" |
483 |
! |
|
484 |
||
485 |
enableDebugButton |
|
178 | 486 |
^ builder valueAspectFor:#enableDebugButton initialValue:false |
0 | 487 |
|
488 |
"Created: / 21.6.2000 / 10:47:34 / Sames" |
|
489 |
"Modified: / 21.6.2000 / 10:51:07 / Sames" |
|
490 |
! |
|
491 |
||
117
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
492 |
enableDefects |
178 | 493 |
^ builder valueAspectFor:#enableDefects initialValue:true |
0 | 494 |
! |
495 |
||
496 |
enableRunButton |
|
178 | 497 |
^ builder valueAspectFor:#enableRunButton initialValue:true |
0 | 498 |
|
499 |
"Created: / 21.6.2000 / 10:47:34 / Sames" |
|
500 |
! |
|
501 |
||
502 |
refreshSuites |
|
458
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
503 |
self updateCategoryList. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
504 |
self updateSuitesList. |
39 | 505 |
|
458
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
506 |
self script value:nil. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
507 |
self tests selection: 0. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
508 |
self defects selection: 0. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
509 |
result := TestResult defaultResultClass new. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
510 |
lastTestCase := nil. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
511 |
self displayRefresh |
0 | 512 |
|
513 |
"Created: / 21.6.2000 / 10:58:34 / Sames" |
|
514 |
"Modified: / 21.6.2000 / 12:19:54 / Sames" |
|
515 |
! |
|
516 |
||
75 | 517 |
rerunSingleSelectedTestCase |
518 |
self debugTest:self defects contents |
|
519 |
! |
|
520 |
||
0 | 521 |
runAllTests |
30 | 522 |
self runSuite: self allTestSuite |
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
523 |
! |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
524 |
|
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
525 |
runDefectTests |
30 | 526 |
| testSuite | |
527 |
(testSuite := self defectTestSuite) notNil ifTrue: |
|
528 |
[self runSuite: testSuite] |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
529 |
! |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
530 |
|
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
531 |
runDefects |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
532 |
allDefects size > 0 ifTrue:[ |
30 | 533 |
^ self runDefectTests |
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
534 |
]. |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
535 |
self runTests |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
536 |
! |
0 | 537 |
|
222 | 538 |
runSuite:aTestSuite |
539 |
|numTests| |
|
540 |
"/ count the number of individual tests |
|
541 |
numTests := 0. |
|
542 |
aTestSuite tests do: |
|
458
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
543 |
[:eachTestOrSubSuite | |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
544 |
(eachTestOrSubSuite isKindOf:TestSuite) |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
545 |
ifTrue:[numTests := numTests + eachTestOrSubSuite tests size.] |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
546 |
ifFalse:[numTests := numTests + 1.]]. |
222 | 547 |
numberOfTestsToRun := numTests. |
548 |
self percentageDone value:0. |
|
549 |
Cursor wait showWhile: |
|
458
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
550 |
[|errorCountBefore failureCountBefore| |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
551 |
self displayRunning. |
19 | 552 |
|
458
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
553 |
"/ self displayDetails: '...'. |
39 | 554 |
|
458
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
555 |
aTestSuite addDependentToHierachy:self. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
556 |
result := TestResult defaultResultClass new. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
557 |
lastTestCase := aTestSuite. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
558 |
self showPercentageIndicator. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
559 |
errorCountBefore := result errorCount. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
560 |
failureCountBefore := result failureCount. |
122 | 561 |
|
458
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
562 |
[|caseName| |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
563 |
aTestSuite |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
564 |
run:result |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
565 |
beforeEachDo: |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
566 |
[:eachCase :eachResult | |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
567 |
caseName := eachCase getTestName. |
640 | 568 |
caseName size == 0 ifTrue:[self halt:'oops - className?']. |
458
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
569 |
self displayDetails:(caseName , '...'). |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
570 |
self testPassed:caseName] |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
571 |
afterEachDo: |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
572 |
[:eachCase :eachResult | |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
573 |
|passed errorCountAfter failureCountAfter| |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
574 |
errorCountAfter := result errorCount. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
575 |
failureCountAfter := result failureCount. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
576 |
passed := (errorCountAfter == errorCountBefore) |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
577 |
& (failureCountAfter == failureCountBefore). |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
578 |
passed == true |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
579 |
ifTrue: |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
580 |
["/ testsWhichPassed add:caseName. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
581 |
"/ testsWhichFailed remove:caseName ifAbsent:nil. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
582 |
] |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
583 |
ifFalse:[self testFailed:caseName withResult:result]. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
584 |
errorCountBefore := errorCountAfter. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
585 |
failureCountBefore := failureCountAfter]] ensure: |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
586 |
[aTestSuite removeDependentFromHierachy:self. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
587 |
self hidePercentageIndicator. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
588 |
self displayNormalColorInProgress.]. |
cea2b7ff8060
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
589 |
self updateWindow] |
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
590 |
! |
0 | 591 |
|
592 |
runTests |
|
30 | 593 |
| testSuite | |
594 |
(testSuite := self freshTestSuite) notNil ifTrue: |
|
595 |
[self runSuite: testSuite] |
|
0 | 596 |
|
597 |
"Modified: / 2.4.2000 / 14:16:10 / Sames" |
|
598 |
! |
|
599 |
||
11 | 600 |
scriptSelectionChanged |
15 | 601 |
self enableRunButton value:(self script value notNil). |
11 | 602 |
! |
603 |
||
0 | 604 |
selection: aValue |
605 |
||
117
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
606 |
aValue = '' ifTrue:[ |
222 | 607 |
defect := aValue. |
117
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
608 |
] ifFalse:[ |
222 | 609 |
self debugTest: aValue |
117
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
610 |
]. |
0 | 611 |
|
612 |
"Created: / 4.4.2000 / 18:54:09 / Sames" |
|
613 |
"Modified: / 4.4.2000 / 19:01:33 / Sames" |
|
614 |
! |
|
615 |
||
616 |
suiteSelectionChanged |
|
8 | 617 |
|ok className description cls| |
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
618 |
|
121 | 619 |
ok := self freshTestSuite notNil and:[self script value notNil]. |
620 |
"/ self enableRunButton value:ok. |
|
621 |
self enableRunButton value:self script value notNil. |
|
117
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
622 |
self enableDefects value:(ok and:[allDefects size > 0]). |
0 | 623 |
|
8 | 624 |
self script value notNil ifTrue:[ |
222 | 625 |
self selectedScript notNil ifTrue:[ |
626 |
className := self selectedScript string. |
|
627 |
]. |
|
628 |
(ok and:[className notNil]) ifTrue:[ |
|
629 |
cls := Smalltalk at:className. |
|
630 |
(cls class includesSelector:#description) ifTrue:[ |
|
631 |
description := cls description. |
|
632 |
] |
|
633 |
]. |
|
8 | 634 |
]. |
17 | 635 |
self displayDetails:nil. |
636 |
self displayMode: (description ? ''). |
|
637 |
self displayGray. |
|
8 | 638 |
|
0 | 639 |
"Created: / 21.6.2000 / 11:31:25 / Sames" |
640 |
"Modified: / 21.6.2000 / 11:32:54 / Sames" |
|
24
0f897c4468c3
automatic update, when new testCase classes arrive,
Claus Gittinger <cg@exept.de>
parents:
23
diff
changeset
|
641 |
! |
0f897c4468c3
automatic update, when new testCase classes arrive,
Claus Gittinger <cg@exept.de>
parents:
23
diff
changeset
|
642 |
|
39 | 643 |
suitesInCategory |
222 | 644 |
|suites cat allCategories| |
39 | 645 |
|
222 | 646 |
cat := self category value. |
647 |
allCategories := (cat = '* all *'). |
|
39 | 648 |
|
222 | 649 |
suites := TestCase allSubclasses |
650 |
select:[:each | |
|
651 |
true "/ "cg:TestCaseHelper is gone -->" ((each isSubclassOf:TestCaseHelper) not) |
|
652 |
and:[each isAbstract not |
|
653 |
and:[allCategories or:[cat = each category]]]] |
|
654 |
thenCollect: [:each | each name]. |
|
655 |
suites sort. |
|
656 |
^ suites |
|
39 | 657 |
! |
658 |
||
659 |
updateCategoryList |
|
451 | 660 |
|categories| |
39 | 661 |
|
451 | 662 |
categories := (TestCase allSubclasses collect:[:each | each category] as:Set) asOrderedCollection. |
663 |
categories sort. |
|
664 |
categories addFirst:'* all *'. |
|
665 |
self categoryList value:categories. |
|
39 | 666 |
! |
667 |
||
24
0f897c4468c3
automatic update, when new testCase classes arrive,
Claus Gittinger <cg@exept.de>
parents:
23
diff
changeset
|
668 |
updateSuitesList |
654 | 669 |
|suites| |
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
670 |
|
654 | 671 |
suites := self suitesInCategory. |
672 |
suites := suites |
|
673 |
collect:[:eachSuiteName | |
|
674 |
(testsWhichFailed includes:eachSuiteName) ifTrue:[ |
|
675 |
eachSuiteName withColor:(self class colorForFailedTests). |
|
676 |
] ifFalse:[ |
|
677 |
(testsWhichPassed includes:eachSuiteName) ifTrue:[ |
|
678 |
eachSuiteName withColor:(self class colorForPassedTests). |
|
679 |
] ifFalse:[ |
|
680 |
eachSuiteName |
|
681 |
] |
|
682 |
]. |
|
683 |
]. |
|
684 |
self scriptModel value: suites. |
|
0 | 685 |
! ! |
686 |
||
442 | 687 |
!TestRunner methodsFor:'initialize-release'! |
688 |
||
689 |
release |
|
690 |
Smalltalk removeDependent:self. |
|
691 |
super release. |
|
692 |
! ! |
|
693 |
||
68 | 694 |
!TestRunner methodsFor:'private'! |
0 | 695 |
|
80 | 696 |
addToFailedTests:caseName |
697 |
testsWhichFailed add:caseName. |
|
698 |
! |
|
699 |
||
700 |
addToPassedTests:caseName |
|
701 |
testsWhichPassed add:caseName. |
|
702 |
! |
|
703 |
||
0 | 704 |
allTestSuite |
665 | 705 |
"generate and return a suite for all tests, except SUnitTests" |
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
706 |
|
665 | 707 |
| tokens stream suite| |
39 | 708 |
|
665 | 709 |
tokens := (self suitesInCategory |
710 |
collect: [:eachName | eachName ", '*' " ]) |
|
711 |
copyWithout: 'SUnitTest* '. |
|
712 |
stream := WriteStream on:''. |
|
713 |
tokens do: [:each | stream nextPutAll:each; space]. |
|
714 |
suite := TestSuitesScripter run: stream contents. |
|
715 |
suite name:'all'. |
|
716 |
^ suite |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
717 |
! |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
718 |
|
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
719 |
defectTestSuite |
222 | 720 |
|suite| |
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
721 |
|
222 | 722 |
suite := TestSuite new. |
723 |
suite name:'defects'. |
|
724 |
allDefects keysAndValuesDo:[:nm :test | |
|
725 |
suite addTest:test. |
|
726 |
]. |
|
727 |
^suite |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
728 |
! |
0 | 729 |
|
222 | 730 |
formatTime: aTime |
30 | 731 |
aTime hours > 0 ifTrue: [^aTime hours printString , 'h']. |
732 |
aTime minutes > 0 ifTrue: [^aTime minutes printString , 'min']. |
|
733 |
^aTime seconds printString , ' sec' |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
734 |
! |
0 | 735 |
|
736 |
freshTestSuite |
|
222 | 737 |
|tests suite| |
0 | 738 |
|
222 | 739 |
tests := self tests contents. |
740 |
tests isNil ifTrue:[ ^ nil]. |
|
741 |
tests := tests string. |
|
742 |
suite := TestSuitesScripter run: tests. |
|
743 |
^ suite |
|
0 | 744 |
|
745 |
"Modified: / 4.4.2000 / 20:13:41 / Sames" |
|
746 |
! |
|
747 |
||
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
748 |
initialize |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
749 |
super initialize. |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
750 |
|
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
751 |
testsWhichPassed := Set new. |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
752 |
testsWhichFailed := Set new. |
83 | 753 |
|
754 |
TestCase allSubclassesDo:[:cls | |
|
579 | 755 |
|lastResult className| |
87
24e88e7f5d88
remember individual failed cases.
Claus Gittinger <cg@exept.de>
parents:
86
diff
changeset
|
756 |
|
579 | 757 |
cls isAbstract ifFalse:[ |
758 |
lastResult := cls lastTestRunResultOrNil. |
|
759 |
lastResult notNil ifTrue:[ |
|
760 |
className := cls name. |
|
761 |
lastResult == TestResult statePass ifTrue:[ |
|
762 |
testsWhichPassed add:className |
|
763 |
] ifFalse:[ |
|
764 |
testsWhichFailed add:className |
|
765 |
] |
|
766 |
] |
|
767 |
] |
|
83 | 768 |
]. |
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
769 |
! |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
770 |
|
222 | 771 |
postOpenWith: aBuilder |
0 | 772 |
"automatically generated by UIPainter ..." |
773 |
||
774 |
super postOpenWith: aBuilder. |
|
775 |
self tests defaultLabel: ''. |
|
11 | 776 |
"/ self tests selection: 'ExampleSetTest'. self script value:1. |
15 | 777 |
|
778 |
self enableRunButton value: (self script value notNil). |
|
0 | 779 |
self enableDebugButton value: false. |
117
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
780 |
self enableDefects value: false. |
24
0f897c4468c3
automatic update, when new testCase classes arrive,
Claus Gittinger <cg@exept.de>
parents:
23
diff
changeset
|
781 |
self script onChangeSend: #suiteSelectionChanged to:self. |
0f897c4468c3
automatic update, when new testCase classes arrive,
Claus Gittinger <cg@exept.de>
parents:
23
diff
changeset
|
782 |
|
0f897c4468c3
automatic update, when new testCase classes arrive,
Claus Gittinger <cg@exept.de>
parents:
23
diff
changeset
|
783 |
Smalltalk addDependent:self. |
0 | 784 |
|
785 |
"Created: / 2.4.2000 / 14:44:32 / Sames" |
|
786 |
"Modified: / 21.6.2000 / 12:06:30 / Sames" |
|
787 |
! |
|
788 |
||
80 | 789 |
removeFromFailedTests:caseName |
790 |
testsWhichFailed remove:caseName ifAbsent:nil. |
|
791 |
! |
|
792 |
||
793 |
removeFromPassedTests:caseName |
|
794 |
testsWhichPassed remove:caseName ifAbsent:nil. |
|
795 |
! |
|
796 |
||
60 | 797 |
selectScriptNamed:aScriptName |
798 |
|idx scriptClass| |
|
799 |
||
800 |
idx := self scriptModel value indexOf:aScriptName. |
|
801 |
self script value:idx. |
|
802 |
||
803 |
self updateCategoryList. |
|
804 |
||
805 |
scriptClass := Smalltalk at:aScriptName asSymbol. |
|
806 |
scriptClass notNil ifTrue:[ |
|
222 | 807 |
self category value:scriptClass category. |
60 | 808 |
] |
809 |
! |
|
810 |
||
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
811 |
selectedScript |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
812 |
|scriptIndex| |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
813 |
|
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
814 |
scriptIndex := self script value. |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
815 |
scriptIndex isNil ifTrue:[ |
222 | 816 |
^ '' |
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
817 |
]. |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
818 |
^ self scriptModel value at:scriptIndex ifAbsent:nil. |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
819 |
! |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
820 |
|
87
24e88e7f5d88
remember individual failed cases.
Claus Gittinger <cg@exept.de>
parents:
86
diff
changeset
|
821 |
testFailed:caseName withResult:result |
80 | 822 |
|cls| |
88 | 823 |
|
80 | 824 |
self removeFromPassedTests:caseName. |
825 |
self addToFailedTests:caseName. |
|
826 |
||
827 |
(cls := Smalltalk classNamed:caseName) notNil ifTrue:[ |
|
222 | 828 |
cls rememberFailedTestRunWithResult:result. |
80 | 829 |
]. |
830 |
! |
|
831 |
||
832 |
testPassed:caseName |
|
833 |
|cls| |
|
834 |
||
835 |
self removeFromFailedTests:caseName. |
|
836 |
self addToPassedTests:caseName. |
|
837 |
||
85 | 838 |
"/ Transcript show:'passed: '; showCR:caseName. |
839 |
"/ Transcript show:'passed: '; showCR:caseName className. |
|
80 | 840 |
|
841 |
(cls := Smalltalk classNamed:caseName) notNil ifTrue:[ |
|
222 | 842 |
cls rememberPassedTestRun |
80 | 843 |
]. |
844 |
! |
|
845 |
||
0 | 846 |
timeSinceLastPassAsString |
30 | 847 |
lastPass isNil ifTrue: [^'']. |
848 |
^', ' , (self formatTime: (Time now subtractTime: lastPass getSeconds)) , ' since last Pass' |
|
0 | 849 |
|
850 |
"Modified: / 3.4.2000 / 19:17:11 / Sames" |
|
851 |
! ! |
|
852 |
||
68 | 853 |
!TestRunner methodsFor:'updating'! |
0 | 854 |
|
855 |
displayColor: aColorValue |
|
856 |
||
30 | 857 |
(builder componentAt: #mode) widget insideColor: aColorValue. |
858 |
(builder componentAt: #details) widget insideColor: aColorValue. |
|
0 | 859 |
|
860 |
"Modified: / 2.4.2000 / 14:21:42 / Sames" |
|
861 |
! |
|
862 |
||
863 |
displayDefault |
|
30 | 864 |
self displayColor: self tests backgroundColor |
0 | 865 |
|
866 |
"Created: / 21.6.2000 / 12:28:06 / Sames" |
|
867 |
"Modified: / 21.6.2000 / 12:35:09 / Sames" |
|
868 |
! |
|
869 |
||
222 | 870 |
displayDefects: aCollection |
117
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
871 |
| failedTests| |
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
872 |
aCollection isEmpty ifTrue: [ |
640 | 873 |
self selectionHolder value:''. |
874 |
self enableDefects value:false. |
|
875 |
self enableDebugButton value:false. |
|
876 |
^ self |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
877 |
]. |
0 | 878 |
allDefects := Dictionary new. |
879 |
aCollection do: [:each | allDefects at: each printString put: each]. |
|
640 | 880 |
failedTests := allDefects keysSorted. |
117
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
881 |
self defectMenu value: failedTests. |
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
882 |
"/ self selectionHolder value: failedTests first withoutNotifying:self. |
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
883 |
self enableDefects value:true. |
0 | 884 |
|
885 |
"Modified: / 4.4.2000 / 20:11:06 / Sames" |
|
886 |
! |
|
887 |
||
222 | 888 |
displayDetails: aString |
94 | 889 |
self details value: aString. |
890 |
self repairDamage. |
|
0 | 891 |
|
892 |
"Modified: / 21.6.2000 / 11:10:14 / Sames" |
|
893 |
! |
|
894 |
||
25
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
895 |
displayErrorColorInProgress |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
896 |
(self builder componentAt:#ProgressIndicator1) |
42 | 897 |
foregroundColor: (self class colorForFailedTests). |
25
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
898 |
|
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
899 |
"/ (self builder componentAt:#ProgressIndicator1) |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
900 |
"/ backgroundColor: (Color red:67 green:0 blue:0) |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
901 |
! |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
902 |
|
0 | 903 |
displayFail |
30 | 904 |
self displayRed. |
905 |
self displayMode: 'Fail'. |
|
906 |
self displayDetails: result printString. |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
907 |
! |
0 | 908 |
|
17 | 909 |
displayGray |
30 | 910 |
self displayColor: (View defaultViewBackgroundColor) |
17 | 911 |
! |
912 |
||
0 | 913 |
displayGreen |
30 | 914 |
self displayColor: ColorValue green |
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
915 |
! |
0 | 916 |
|
222 | 917 |
displayMode: aString |
918 |
self mode value: aString. |
|
919 |
self repairDamage. |
|
0 | 920 |
|
921 |
"Modified: / 21.6.2000 / 11:14:19 / Sames" |
|
922 |
! |
|
923 |
||
25
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
924 |
displayNormalColorInProgress |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
925 |
(self builder componentAt:#ProgressIndicator1) |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
926 |
foregroundColor: (Color red:33 green:33 blue:0); |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
927 |
backgroundColor: (Color red:67 green:67 blue:0) |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
928 |
! |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
929 |
|
0 | 930 |
displayPass |
55 | 931 |
self displayGreen. |
222 | 932 |
(lastTestCase notNil |
64 | 933 |
and:[lastTestCase name notNil]) ifTrue:[ |
222 | 934 |
self displayMode: 'Pass ' , lastTestCase name. |
64 | 935 |
] ifFalse:[ |
222 | 936 |
self displayMode: 'Pass'. |
64 | 937 |
]. |
0 | 938 |
self displayDetails: result runCount printString , ' run' , self timeSinceLastPassAsString. |
939 |
lastPass := Time now |
|
940 |
||
941 |
"Modified: / 21.6.2000 / 12:14:52 / Sames" |
|
942 |
! |
|
943 |
||
944 |
displayRed |
|
30 | 945 |
self displayColor: ColorValue red. |
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
946 |
! |
0 | 947 |
|
948 |
displayRefresh |
|
949 |
self displayMode: 'N/A'. |
|
950 |
self displayDetails:'...'. |
|
951 |
self updateDefects. |
|
79 | 952 |
self enableRunButton value: (self script value notNil). |
117
13bdbc0cefce
Better handling of failed testcases.
Stefan Vogel <sv@exept.de>
parents:
115
diff
changeset
|
953 |
self enableDefects value: false. |
0 | 954 |
self enableDebugButton value: false. |
955 |
self displayDefault |
|
956 |
||
957 |
"Created: / 21.6.2000 / 12:14:11 / Sames" |
|
958 |
"Modified: / 21.6.2000 / 12:28:24 / Sames" |
|
959 |
! |
|
960 |
||
961 |
displayRunning |
|
222 | 962 |
self displayRunning:(self selectedScript ? 'all') string. |
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
963 |
! |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
964 |
|
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
965 |
displayRunning:scriptName |
222 | 966 |
self displayYellow. |
967 |
self displayMode:('running ' , scriptName allBold). |
|
61
b9204f5672ae
show each cases selector as it is executed
Claus Gittinger <cg@exept.de>
parents:
60
diff
changeset
|
968 |
"/ self displayDetails: '...'. |
222 | 969 |
self repairDamage. |
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
970 |
! |
0 | 971 |
|
972 |
displayYellow |
|
30 | 973 |
self displayColor: ColorValue yellow |
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
974 |
! |
0 | 975 |
|
25
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
976 |
hidePercentageIndicator |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
977 |
self percentageIndicatorVisible value:false. |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
978 |
! |
24
0f897c4468c3
automatic update, when new testCase classes arrive,
Claus Gittinger <cg@exept.de>
parents:
23
diff
changeset
|
979 |
|
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
980 |
repairDamage |
82 | 981 |
|wg| |
982 |
||
983 |
(wg := self windowGroup) notNil ifTrue:[wg repairDamage]. |
|
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
984 |
! |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
985 |
|
25
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
986 |
showPercentageIndicator |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
987 |
self percentageIndicatorVisible value:true. |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
988 |
! |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
989 |
|
30 | 990 |
update:something with:aParameter from:changedObject |
24
0f897c4468c3
automatic update, when new testCase classes arrive,
Claus Gittinger <cg@exept.de>
parents:
23
diff
changeset
|
991 |
changedObject == Smalltalk ifTrue:[ |
222 | 992 |
(changedObject isBehavior and:[changedObject isSubclassOf:TestCase]) ifTrue:[ |
993 |
self updateSuitesList |
|
994 |
]. |
|
995 |
^ self |
|
25
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
996 |
]. |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
997 |
|
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
998 |
(changedObject isKindOf: TestSuite) ifTrue: [ |
222 | 999 |
self displayRunning:changedObject name. |
1000 |
^ self |
|
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
1001 |
]. |
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
1002 |
|
30 | 1003 |
(changedObject isKindOf: TestCase) ifTrue: [ |
222 | 1004 |
(result errorCount + result failureCount) > 0 ifTrue:[ |
1005 |
self displayErrorColorInProgress. |
|
1006 |
]. |
|
1007 |
self percentageDone value:(result runCount / numberOfTestsToRun * 100) rounded. |
|
1008 |
self displayDetails: changedObject printString. |
|
1009 |
^ self |
|
25
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
1010 |
]. |
ab09e4669864
change progressindicators color to red, when an error occurs.
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
1011 |
|
30 | 1012 |
super update:something with:aParameter from:changedObject |
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
1013 |
! |
0 | 1014 |
|
1015 |
updateDefects |
|
222 | 1016 |
|script| |
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
1017 |
|
222 | 1018 |
script := self selectedScript. |
1019 |
script notNil ifTrue:[script := script string]. |
|
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
1020 |
|
222 | 1021 |
self displayDefects: result defects. |
38
5fb751a669eb
better update (name) and mark failed/passed suites in list
Claus Gittinger <cg@exept.de>
parents:
30
diff
changeset
|
1022 |
|
222 | 1023 |
script notNil ifTrue:[ |
1024 |
result hasPassed ifTrue:[ |
|
1025 |
self testPassed:script |
|
1026 |
] ifFalse:[ |
|
1027 |
self testFailed:script withResult:result |
|
1028 |
]. |
|
1029 |
]. |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
1030 |
! |
0 | 1031 |
|
1032 |
updateWindow |
|
222 | 1033 |
result hasPassed |
1034 |
ifTrue: [self displayPass] |
|
1035 |
ifFalse: [self displayFail]. |
|
1036 |
self updateDefects. |
|
1037 |
self updateSuitesList. "/ for colors |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
5
diff
changeset
|
1038 |
! ! |
0 | 1039 |
|
11 | 1040 |
!TestRunner class methodsFor:'documentation'! |
1041 |
||
1042 |
version |
|
640 | 1043 |
^ '$Header$' |
206 | 1044 |
! |
1045 |
||
1046 |
version_CVS |
|
640 | 1047 |
^ '$Header$' |
222 | 1048 |
! |
1049 |
||
1050 |
version_SVN |
|
640 | 1051 |
^ '$Id$' |
11 | 1052 |
! ! |
579 | 1053 |