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