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