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