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