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