author | Claus Gittinger <cg@exept.de> |
Sun, 28 Apr 2013 15:41:55 +0200 | |
changeset 578 | be4d2b6894b9 |
parent 576 | 55ef6aaf19cb |
child 587 | 570faa368e0d |
permissions | -rw-r--r-- |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
1 |
"{ Package: 'stx:goodies/sunit' }" |
0 | 2 |
|
222 | 3 |
TestAsserter subclass:#TestCase |
377 | 4 |
instanceVariableNames:'testSelector' |
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'SUnit-Base' |
|
0 | 8 |
! |
9 |
||
382 | 10 |
TestCase class instanceVariableNames:'lastOutcomes' |
81 | 11 |
|
12 |
" |
|
13 |
No other class instance variables are inherited by this class. |
|
14 |
" |
|
15 |
! |
|
16 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
17 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
18 |
!TestCase class methodsFor:'initialization'! |
12 | 19 |
|
435 | 20 |
flushAll |
21 |
||
22 |
"Flush all remembered outcomes in all testcases" |
|
23 |
||
24 |
self withAllSubclassesDo:[:cls| |
|
25 |
cls flushRememberedOutcomes |
|
26 |
] |
|
27 |
||
28 |
"Created: / 17-11-2011 / 19:18:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
29 |
! |
|
30 |
||
31 |
flushRememberedOutcomes |
|
32 |
||
33 |
"Flushes all remembered outcomes for the receiver" |
|
34 |
||
35 |
| outcomes | |
|
36 |
||
37 |
lastOutcomes isNil ifTrue:[^self]. |
|
38 |
outcomes := lastOutcomes. |
|
39 |
lastOutcomes := nil. |
|
40 |
outcomes do:[:outcome| |
|
41 |
self lastTestRunResultChanged: outcome selector. |
|
42 |
] |
|
43 |
||
44 |
"Created: / 17-11-2011 / 19:17:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
45 |
! |
|
46 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
47 |
initialize |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
48 |
ResumableTestFailure autoload |
138 | 49 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
50 |
" |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
51 |
self initialize |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
52 |
" |
326 | 53 |
! |
54 |
||
55 |
postAutoload |
|
433 | 56 |
|pd| |
57 |
||
58 |
(pd := self projectDefinitionClass) notNil ifTrue:[ |
|
59 |
pd loadExtensions |
|
60 |
] |
|
61 |
||
62 |
"Modified: / 02-11-2011 / 15:44:58 / sr" |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
63 |
! ! |
138 | 64 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
65 |
!TestCase class methodsFor:'instance creation'! |
2 | 66 |
|
288 | 67 |
asTestCase |
68 |
^ self |
|
69 |
||
70 |
"Created: / 02-08-2011 / 09:12:13 / cg" |
|
71 |
! |
|
72 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
73 |
debug: aSymbol |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
74 |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
75 |
^(self selector: aSymbol) debug |
138 | 76 |
! |
2 | 77 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
78 |
run: aSymbol |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
79 |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
80 |
^(self selector: aSymbol) run |
138 | 81 |
! |
82 |
||
0 | 83 |
selector: aSymbol |
103 | 84 |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
85 |
^self new setTestSelector: aSymbol |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
86 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
87 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
88 |
suite |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
89 |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
90 |
^self buildSuite |
0 | 91 |
! ! |
92 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
93 |
!TestCase class methodsFor:'accessing'! |
66 | 94 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
95 |
allTestSelectors |
328
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
96 |
| answer pivotClass lookupRoot | |
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
97 |
|
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
98 |
answer := Set withAll: self testSelectors. |
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
99 |
self shouldInheritSelectors ifTrue:[ |
421 | 100 |
pivotClass := self superclass. |
328
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
101 |
lookupRoot := self lookupHierarchyRoot. |
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
102 |
[pivotClass == lookupRoot] whileFalse:[ |
421 | 103 |
answer addAll: pivotClass testSelectors. |
328
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
104 |
pivotClass := pivotClass superclass. |
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
105 |
] |
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
106 |
]. |
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
107 |
^answer asSortedCollection asOrderedCollection |
420 | 108 |
|
421 | 109 |
"Modified: / 21-08-2011 / 15:06:11 / cg" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
110 |
! |
66 | 111 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
112 |
forgetLastTestRunResult |
390 | 113 |
|
114 |
Smalltalk changed:#lastTestRunResult with:(Array with:self with:nil). |
|
115 |
self changed:#lastTestRunResult. |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
116 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
117 |
"Modified: / 06-08-2006 / 11:40:07 / cg" |
390 | 118 |
"Modified: / 20-08-2011 / 15:10:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
119 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
120 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
121 |
isTestSelector:aSelector |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
122 |
|
290 | 123 |
^aSelector notNil and:[aSelector startsWith:'test'] |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
124 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
125 |
"Created: / 06-08-2006 / 11:46:17 / cg" |
222 | 126 |
"Modified: / 05-12-2009 / 18:50:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
290 | 127 |
"Modified: / 02-08-2011 / 17:46:51 / cg" |
222 | 128 |
! |
129 |
||
382 | 130 |
lastTestRunResultOrNil |
578 | 131 |
"Returns a state (TestResult stateXXX), depending |
132 |
on the state of the tests: |
|
133 |
statePass if all tests passed, |
|
134 |
stateError if any error, |
|
135 |
stateFail if any fail, |
|
136 |
or nil if never run |
|
137 |
" |
|
222 | 138 |
|
578 | 139 |
|anyFail| |
140 |
||
382 | 141 |
lastOutcomes isNil ifTrue:[^nil]. |
142 |
lastOutcomes size ~= self testSelectors size ifTrue:[^nil]. |
|
578 | 143 |
anyFail := false. |
144 |
||
382 | 145 |
lastOutcomes do:[:outcome| |
578 | 146 |
outcome result == (TestResult stateError) ifTrue:[ |
147 |
^ TestResult stateError |
|
148 |
]. |
|
149 |
outcome result == (TestResult stateFail) ifTrue:[ |
|
150 |
anyFail := true |
|
382 | 151 |
]. |
152 |
]. |
|
578 | 153 |
anyFail ifTrue:[ ^ TestResult stateFail ]. |
154 |
^ TestResult statePass |
|
222 | 155 |
|
382 | 156 |
"Modified: / 20-08-2011 / 14:59:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
157 |
! |
87
24e88e7f5d88
remember individual failed cases.
Claus Gittinger <cg@exept.de>
parents:
82
diff
changeset
|
158 |
|
222 | 159 |
lookupHierarchyRoot |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
160 |
^TestCase |
222 | 161 |
! |
162 |
||
523 | 163 |
rememberOutcome: thisOutcome |
164 |
|thisTestCase someOtherOutcome someOtherTestCase| |
|
165 |
||
166 |
thisTestCase := thisOutcome testCase. |
|
222 | 167 |
|
382 | 168 |
lastOutcomes isNil ifTrue:[ |
169 |
lastOutcomes := OrderedCollection new. |
|
170 |
]. |
|
445 | 171 |
|
523 | 172 |
"Not a nice code, but portable (what: doWithIndex: is not portable?)" |
382 | 173 |
1 to: lastOutcomes size do:[:i| |
523 | 174 |
someOtherOutcome := lastOutcomes at: i. |
175 |
someOtherTestCase := someOtherOutcome testCase. |
|
176 |
"/ compare by classes name - in case it got redefined |
|
524 | 177 |
(someOtherTestCase selector == thisTestCase selector |
178 |
and: [someOtherTestCase class name = thisTestCase class name]) ifTrue:[ |
|
523 | 179 |
"remember; for the timestamp and other info" |
180 |
lastOutcomes at: i put: thisOutcome. |
|
181 |
someOtherOutcome result ~= thisOutcome result ifTrue:[ |
|
182 |
"but only send out change notification to browser if state has changed" |
|
183 |
self lastTestRunResultChanged: thisOutcome selector. |
|
382 | 184 |
]. |
445 | 185 |
^self. |
186 |
]. |
|
222 | 187 |
]. |
523 | 188 |
lastOutcomes add: thisOutcome. |
189 |
self lastTestRunResultChanged: thisOutcome selector. |
|
382 | 190 |
^self |
222 | 191 |
|
382 | 192 |
"Created: / 20-08-2011 / 12:43:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
445 | 193 |
"Modified: / 04-06-2012 / 16:19:07 / cg" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
194 |
! |
81 | 195 |
|
382 | 196 |
rememberedOutcomeFor: selector |
222 | 197 |
|
382 | 198 |
lastOutcomes isNil ifTrue:[^nil]. |
391 | 199 |
^lastOutcomes |
200 |
detect: [:outcome| outcome testCase selector == selector] |
|
201 |
ifNone:[nil]. |
|
87
24e88e7f5d88
remember individual failed cases.
Claus Gittinger <cg@exept.de>
parents:
82
diff
changeset
|
202 |
|
382 | 203 |
"Created: / 20-08-2011 / 14:27:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
204 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
205 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
206 |
resources |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
207 |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
208 |
^#() |
222 | 209 |
! |
210 |
||
211 |
shouldFork |
|
212 |
||
213 |
^false |
|
214 |
||
215 |
"Created: / 13-06-2011 / 16:46:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
103 | 216 |
! |
217 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
218 |
sunitVersion |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
219 |
^'4.0' |
222 | 220 |
! |
221 |
||
391 | 222 |
testSelector:selector result: result |
523 | 223 |
"return true, if the last run of this test had the outcome result" |
382 | 224 |
|
225 |
lastOutcomes isNil ifTrue:[^false]. |
|
523 | 226 |
^ lastOutcomes |
227 |
contains:[:any| |
|
228 |
any testCase class name = self name |
|
229 |
and:[any testCase selector == selector |
|
230 |
and:[any result == result]] |
|
391 | 231 |
] |
232 |
||
233 |
"Created: / 20-08-2011 / 16:15:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
445 | 234 |
"Modified: / 04-06-2012 / 16:12:17 / cg" |
391 | 235 |
! |
236 |
||
237 |
testSelectorError:selector |
|
523 | 238 |
"return true, if the last run of this test failed" |
391 | 239 |
|
523 | 240 |
^self testSelector: selector result: (TestResult stateError) |
222 | 241 |
|
242 |
"Created: / 15-03-2010 / 19:44:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
243 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
244 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
245 |
testSelectorFailed:selector |
523 | 246 |
"return true, if the last run of this test failed" |
222 | 247 |
|
523 | 248 |
^self testSelector: selector result: (TestResult stateFail) |
382 | 249 |
|
391 | 250 |
"Modified: / 20-08-2011 / 16:16:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
251 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
252 |
|
222 | 253 |
testSelectorPassed:selector |
523 | 254 |
"return true, if the last run of this test passed" |
382 | 255 |
|
523 | 256 |
^self testSelector: selector result: (TestResult statePass) |
257 |
||
258 |
"Created: / 15-03-2010 / 17:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
259 |
! |
|
260 |
||
261 |
testSelectorSkipped:selector |
|
262 |
"return true, if the last run of this test was skipped" |
|
263 |
||
264 |
^self testSelector: selector result: (TestResult stateSkip) |
|
211
3a40b828ce9a
comment/format in: #testSelectors
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
265 |
|
222 | 266 |
"Created: / 15-03-2010 / 17:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
267 |
! ! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
268 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
269 |
!TestCase class methodsFor:'building suites'! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
270 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
271 |
buildSuite |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
272 |
| suite | |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
273 |
^self isAbstract |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
274 |
ifTrue: |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
275 |
[suite := self suiteClass named: self name asString. |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
276 |
self allSubclasses |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
277 |
do: [:each | each isAbstract ifFalse: [suite addTest: each buildSuiteFromSelectors]]. |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
278 |
suite] |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
279 |
ifFalse: [self buildSuiteFromSelectors] |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
280 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
281 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
282 |
buildSuiteFromMethods: testMethods |
68 | 283 |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
284 |
^testMethods |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
285 |
inject: (self suiteClass named: self name asString) |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
286 |
into: [:suite :selector | |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
287 |
suite |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
288 |
addTest: (self selector: selector); |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
289 |
yourself] |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
290 |
! |
138 | 291 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
292 |
buildSuiteFromSelectors |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
293 |
^self buildSuiteFromMethods: self allTestSelectors |
68 | 294 |
! |
295 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
296 |
suiteClass |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
297 |
^TestSuite |
68 | 298 |
! ! |
299 |
||
203 | 300 |
!TestCase class methodsFor:'misc ui support'! |
301 |
||
302 |
iconInBrowserSymbol |
|
303 |
<resource: #programImage> |
|
304 |
||
205 | 305 |
|lastResult| |
306 |
||
203 | 307 |
self theNonMetaclass isAbstract ifTrue:[^ super iconInBrowserSymbol]. |
205 | 308 |
|
309 |
lastResult := self lastTestRunResultOrNil. |
|
578 | 310 |
lastResult notNil ifTrue:[ |
311 |
lastResult == TestResult statePass ifTrue:[ |
|
312 |
^ #testCasePassedIcon |
|
313 |
]. |
|
314 |
lastResult == TestResult stateFail ifTrue:[ |
|
315 |
^ #testCaseFailedIcon |
|
316 |
]. |
|
317 |
lastResult == TestResult stateError ifTrue:[ |
|
318 |
^ #testCaseErrorIcon |
|
319 |
]. |
|
205 | 320 |
]. |
203 | 321 |
^ #testCaseClassIcon |
322 |
! ! |
|
323 |
||
222 | 324 |
!TestCase class methodsFor:'private'! |
325 |
||
326 |
addSelector: selector to: collection |
|
327 |
||
328 |
"Adds given selector from collection. Answers |
|
329 |
true iff selector was really added" |
|
330 |
||
331 |
^(collection includes: selector) |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
332 |
ifTrue:[false] |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
333 |
ifFalse:[collection add: selector. true] |
222 | 334 |
|
335 |
"Created: / 15-03-2010 / 18:06:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
336 |
"Modified: / 21-04-2010 / 23:19:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
337 |
! |
|
338 |
||
339 |
lastTestRunResultChanged: selector |
|
340 |
||
341 |
Smalltalk changed:#lastTestRunResult with:(Array with:self with:selector). |
|
342 |
self changed:#lastTestRunResult with:selector. |
|
343 |
||
344 |
"Created: / 15-03-2010 / 19:15:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
345 |
! |
|
346 |
||
347 |
testSelectors |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
348 |
"The API method is allTestSelectors which now includes #shouldInheritSelectors and so handles all cases. Unlike that method, this does not guarantee to return a sorted ordered collection." |
222 | 349 |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
350 |
^self sunitSelectors select: [:each | 'test*' sunitMatch: each] |
222 | 351 |
! ! |
352 |
||
417 | 353 |
!TestCase class methodsFor:'queries'! |
354 |
||
355 |
coveredClassNames |
|
356 |
"should be redefined to return a collection of classes which are tested by |
|
357 |
this suite/case. These classes can be instrumented for coverage analysis, |
|
358 |
before running the suite" |
|
359 |
||
360 |
^ #() |
|
361 |
||
362 |
"Created: / 06-07-2011 / 21:27:03 / cg" |
|
363 |
! |
|
364 |
||
365 |
coveredClasses |
|
366 |
"return a collection of classes which are tested by this suite/case. |
|
367 |
These classes can be instrumented for coverage analysis, |
|
368 |
before running the suite" |
|
369 |
||
370 |
^ self coveredClassNames collect:[:each | Smalltalk classNamed:each] |
|
371 |
||
372 |
"Created: / 04-07-2011 / 18:16:08 / cg" |
|
373 |
! ! |
|
374 |
||
197 | 375 |
!TestCase class methodsFor:'quick testing'! |
376 |
||
377 |
assert: aBoolean |
|
378 |
^ self new assert: aBoolean |
|
379 |
||
380 |
" |
|
381 |
TestCase assert: true |
|
382 |
" |
|
383 |
! |
|
384 |
||
385 |
should: aBlock raise: anError |
|
386 |
^ self new should: aBlock raise: anError |
|
387 |
||
388 |
" |
|
389 |
TestCase should:[ self error ] raise: Error |
|
390 |
" |
|
391 |
! ! |
|
392 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
393 |
!TestCase class methodsFor:'testing'! |
103 | 394 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
395 |
isAbstract |
326 | 396 |
"Override to true if a TestCase subclass is Abstract and should not have |
397 |
TestCase instances built from it" |
|
222 | 398 |
|
326 | 399 |
^self sunitName = #TestCase |
222 | 400 |
! |
401 |
||
402 |
isTestCaseLike |
|
403 |
||
404 |
^true |
|
405 |
||
406 |
"Created: / 06-03-2011 / 00:16:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
407 |
! |
103 | 408 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
409 |
rememberResult:result |
382 | 410 |
|
411 |
result outcomesDo:[:outcome|self rememberOutcome: outcome]. |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
412 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
413 |
"Created: / 05-08-2006 / 12:33:08 / cg" |
382 | 414 |
"Modified: / 20-08-2011 / 14:02:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
415 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
416 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
417 |
runTests |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
418 |
|
391 | 419 |
^self suite run |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
420 |
|
265
125e4f132d46
remember execution time (needed to generate prober reports)
Claus Gittinger <cg@exept.de>
parents:
262
diff
changeset
|
421 |
"Modified: / 30-07-2011 / 09:26:11 / cg" |
391 | 422 |
"Modified: / 20-08-2011 / 16:14:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
423 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
424 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
425 |
shouldInheritSelectors |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
426 |
"I should inherit from an Abstract superclass but not from a concrete one by default, unless I have no testSelectors in which case I must be expecting to inherit them from my superclass. If a test case with selectors wants to inherit selectors from a concrete superclass, override this to true in that subclass." |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
427 |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
428 |
^self ~~ self lookupHierarchyRoot |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
429 |
and: [self superclass isAbstract |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
430 |
or: [self testSelectors isEmpty]] |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
431 |
! ! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
432 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
433 |
!TestCase methodsFor:'accessing'! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
434 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
435 |
resources |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
436 |
"We give TestCase this instance-side method so that methods polymorphic with TestSuite can be code-identical. Having this instance-side method also helps when writing tests of resource behaviour. Except for such tests, it is rare to override this method and should not be done without thought. If there were a good reason why a single test case needed to share tests requiring different resources, it might be legitimate." |
222 | 437 |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
438 |
^self class resources |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
439 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
440 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
441 |
selector |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
442 |
^testSelector |
222 | 443 |
! |
444 |
||
445 |
shouldFork |
|
446 |
||
447 |
^self class shouldFork |
|
448 |
||
449 |
"Created: / 13-06-2011 / 16:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
305 | 450 |
! |
451 |
||
529 | 452 |
shouldSkip |
453 |
"Returns true, if this testcase should be skipped when a testsuite is run. |
|
454 |
This inly a hint, a test runner is not obliged to respect return value. |
|
455 |
||
456 |
Currently, the only user is stx/goodies/builder/reports" |
|
457 |
||
458 |
| method | |
|
459 |
method := self class lookupMethodFor: testSelector. |
|
460 |
method annotationsAt:#ignore orAt: #skip do:[:annotation| |
|
461 |
^true |
|
462 |
]. |
|
463 |
^false |
|
464 |
||
465 |
"Created: / 28-11-2012 / 18:03:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
466 |
! |
|
467 |
||
305 | 468 |
testCount |
469 |
||
470 |
^1 |
|
471 |
||
472 |
"Created: / 04-08-2011 / 13:03:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
473 |
! ! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
474 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
475 |
!TestCase methodsFor:'accessing & queries'! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
476 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
477 |
unfinished |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
478 |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
479 |
"indicates an unfinished test" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
480 |
! ! |
97 | 481 |
|
482 |
!TestCase methodsFor:'assertions'! |
|
66 | 483 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
484 |
assert:aBlock completesInSeconds:aNumber |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
485 |
"fail, if aBlock does not finish its work in aNumber seconds" |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
486 |
|
179
caba0f640d13
context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
487 |
<resource: #skipInDebuggersWalkBack> |
caba0f640d13
context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
488 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
489 |
|done process semaphore| |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
490 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
491 |
done := false. |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
492 |
semaphore := Semaphore new. |
174 | 493 |
process := [ |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
494 |
aBlock value. |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
495 |
done := true. |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
496 |
semaphore signal |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
497 |
] fork. |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
498 |
semaphore waitWithTimeout: aNumber. |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
499 |
process terminate. |
222 | 500 |
self assert: done |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
501 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
502 |
" |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
503 |
self new assert:[Delay waitForSeconds:2] completesInSeconds:1 |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
504 |
" |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
505 |
" |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
506 |
self new assert:[Delay waitForSeconds:1] completesInSeconds:2 |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
507 |
" |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
508 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
509 |
|
222 | 510 |
assert: aBoolean message:messageIfFailing |
531 | 511 |
<resource: #skipInDebuggersWalkBack> |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
512 |
|
222 | 513 |
^self assert: aBoolean description: messageIfFailing |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
514 |
|
531 | 515 |
"Modified: / 15-12-2012 / 17:20:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
516 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
517 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
518 |
assertFalse:aBoolean |
179
caba0f640d13
context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
519 |
<resource: #skipInDebuggersWalkBack> |
caba0f640d13
context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
520 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
521 |
^ self assert:aBoolean not |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
522 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
523 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
524 |
assertFalse:aBoolean named:testName |
179
caba0f640d13
context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
525 |
<resource: #skipInDebuggersWalkBack> |
caba0f640d13
context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
526 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
527 |
^ self assert:aBoolean not |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
528 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
529 |
|
222 | 530 |
assertTrue:aBoolean |
179
caba0f640d13
context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
531 |
<resource: #skipInDebuggersWalkBack> |
caba0f640d13
context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
532 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
533 |
^ self assert:aBoolean |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
534 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
535 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
536 |
assertTrue:aBoolean named:testName |
179
caba0f640d13
context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
537 |
<resource: #skipInDebuggersWalkBack> |
caba0f640d13
context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
538 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
539 |
^ self assert:aBoolean |
66 | 540 |
! ! |
541 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
542 |
!TestCase methodsFor:'dependencies'! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
543 |
|
222 | 544 |
addDependentToHierachy: anObject |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
545 |
"an empty method. for Composite compability with TestSuite" |
222 | 546 |
! |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
547 |
|
222 | 548 |
removeDependentFromHierachy: anObject |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
549 |
"an empty method. for Composite compability with TestSuite" |
222 | 550 |
! ! |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
551 |
|
222 | 552 |
!TestCase methodsFor:'deprecated'! |
553 |
||
554 |
should: aBlock |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
555 |
self assert: aBlock value |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
556 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
557 |
|
222 | 558 |
should: aBlock description: aString |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
559 |
self assert: aBlock value description: aString |
222 | 560 |
! |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
561 |
|
222 | 562 |
shouldnt: aBlock |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
563 |
self deny: aBlock value |
222 | 564 |
! |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
565 |
|
222 | 566 |
shouldnt: aBlock description: aString |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
567 |
self deny: aBlock value description: aString |
222 | 568 |
! |
569 |
||
570 |
signalFailure: aString |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
571 |
TestResult failure sunitSignalWith: aString. |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
572 |
! ! |
67 | 573 |
|
574 |
!TestCase methodsFor:'printing'! |
|
575 |
||
222 | 576 |
getTestName |
577 |
||
578 |
^testSelector. |
|
579 |
||
580 |
"Modified: / 05-12-2009 / 17:47:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
581 |
! |
|
582 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
583 |
name |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
584 |
^ self class name. |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
585 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
586 |
|
67 | 587 |
printOn: aStream |
588 |
||
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
589 |
aStream |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
590 |
nextPutAll: self class printString; |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
591 |
nextPutAll: '>>#'; |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
592 |
nextPutAll: testSelector |
67 | 593 |
! ! |
594 |
||
595 |
!TestCase methodsFor:'private'! |
|
596 |
||
222 | 597 |
executeShould: aBlock inScopeOf: anExceptionalEvent |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
598 |
"/ ^[aBlock value. |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
599 |
"/ false] sunitOn: anExceptionalEvent |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
600 |
"/ do: [:ex | ex sunitExitWith: true] |
103 | 601 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
602 |
"/ [[aBlock value] |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
603 |
"/ on: anExceptionalEvent |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
604 |
"/ do: [:ex | ^true]] |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
605 |
"/ on: TestResult exError |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
606 |
"/ do: [:ex | ^false]. |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
607 |
[aBlock value] |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
608 |
on: anExceptionalEvent |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
609 |
do: [:ex | ^true]. |
103 | 610 |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
611 |
^false. |
67 | 612 |
! |
613 |
||
614 |
performTest |
|
328
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
615 |
self perform: testSelector sunitAsSymbol |
67 | 616 |
! |
617 |
||
576 | 618 |
safeTearDown |
619 |
"Have to handle Abort. When tearDown is called as inside an ensure block after |
|
620 |
an abort in the debugger of an errornous test case and raises an error with a debugger |
|
621 |
itself." |
|
622 |
||
623 |
AbortOperationRequest handle:[:ex| ] do:[self tearDown]. |
|
624 |
! |
|
625 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
626 |
setTestSelector: aSymbol |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
627 |
testSelector := aSymbol |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
628 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
629 |
|
222 | 630 |
signalFailure:aString resumable:isResumable |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
631 |
"/ TestResult failure sunitSignalWith: aString |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
632 |
|
179
caba0f640d13
context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
633 |
<resource: #skipInDebuggersWalkBack> |
caba0f640d13
context skipping in debugger generalized
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
634 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
635 |
isResumable ifTrue:[ |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
636 |
TestResult resumableFailure |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
637 |
raiseRequestWith:nil |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
638 |
errorString:aString |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
639 |
in:thisContext sender sender |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
640 |
] ifFalse:[ |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
641 |
TestResult failure |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
642 |
raiseErrorString:aString |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
643 |
in:thisContext sender sender |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
644 |
]. |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
645 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
646 |
"Modified: / 06-08-2006 / 22:55:55 / cg" |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
647 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
648 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
649 |
signalUnavailableResources |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
650 |
|
222 | 651 |
self resources do:[:res | |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
652 |
res isAvailable ifFalse:[ |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
653 |
^ res signalInitializationError |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
654 |
] |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
655 |
]. |
67 | 656 |
! ! |
657 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
658 |
!TestCase methodsFor:'queries'! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
659 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
660 |
isTestCase |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
661 |
^ true |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
662 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
663 |
|
221 | 664 |
isTestCaseLike |
665 |
^ true |
|
666 |
||
667 |
"Created: / 29-06-2011 / 20:37:57 / cg" |
|
668 |
! |
|
669 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
670 |
isTestSuite |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
671 |
^ false |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
672 |
! ! |
122 | 673 |
|
67 | 674 |
!TestCase methodsFor:'running'! |
675 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
676 |
debug |
382 | 677 |
|
524 | 678 |
| testCase outcome result| |
382 | 679 |
|
680 |
[ |
|
575 | 681 |
result := TestResult stateError. |
524 | 682 |
[ |
550 | 683 |
(testCase := self class selector: testSelector) runCase. |
575 | 684 |
result := TestResult statePass. |
550 | 685 |
] sunitOn:(TestResult failure) do: [:ex | |
573
428c2391c132
use #creator instead of #signal
Claus Gittinger <cg@exept.de>
parents:
570
diff
changeset
|
686 |
ex creator == TestSkipped ifTrue:[ |
550 | 687 |
result := TestResult stateSkip. |
688 |
] ifFalse:[ |
|
524 | 689 |
result := TestResult stateFail. |
690 |
]. |
|
563 | 691 |
"I want a debugger to open here..." |
692 |
"the only really portable dialect query..." |
|
693 |
((Smalltalk respondsTo:#isSmalltalkX) and:[Smalltalk isSmalltalkX]) ifTrue:[ |
|
694 |
"/ debug |
|
695 |
Debugger |
|
696 |
enter:ex raiseContext |
|
697 |
withMessage:(ex description) |
|
698 |
mayProceed:true. |
|
699 |
ex proceed. |
|
700 |
] ifFalse:[ |
|
701 |
"is there a portable way to open a debugger?" |
|
702 |
self halt:(ex description) |
|
575 | 703 |
]. |
524 | 704 |
]. |
705 |
||
575 | 706 |
] sunitEnsure: [ |
564 | 707 |
" if proceeded in the debugger, we arrive here; " |
708 |
" but still, this is not always a pass !! " |
|
382 | 709 |
outcome := TestCaseOutcome new. |
710 |
outcome testCase: testCase. |
|
524 | 711 |
outcome result: result. |
382 | 712 |
outcome remember. |
713 |
TestResource resetResources: self resources |
|
714 |
]. |
|
254
7f4b9fc9756b
changed: #debug - remembers test as passed if no error occur during debugging
vrany
parents:
240
diff
changeset
|
715 |
|
7f4b9fc9756b
changed: #debug - remembers test as passed if no error occur during debugging
vrany
parents:
240
diff
changeset
|
716 |
"Modified: / 07-07-2011 / 11:10:50 / jv" |
7f4b9fc9756b
changed: #debug - remembers test as passed if no error occur during debugging
vrany
parents:
240
diff
changeset
|
717 |
"Modified: / 07-07-2011 / 11:34:08 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
382 | 718 |
"Modified: / 20-08-2011 / 14:15:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
719 |
! |
67 | 720 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
721 |
debugAsFailure |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
722 |
| semaphore | |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
723 |
semaphore := Semaphore new. |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
724 |
[semaphore wait. TestResource resetResources: self resources] fork. |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
725 |
(self class selector: testSelector) runCaseAsFailure: semaphore. |
67 | 726 |
! |
727 |
||
222 | 728 |
debugUsing:aSymbol |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
729 |
self signalUnavailableResources. |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
730 |
[ |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
731 |
"/ used to be: |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
732 |
"/ (self class selector:testSelector) perform:aSymbol |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
733 |
"/ which is bad for subclasses which need more arguments. |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
734 |
"/ why not use: |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
735 |
"/ self copy perform:aSymbol |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
736 |
"/ or even |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
737 |
"/ self perform:aSymbol |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
738 |
self perform:aSymbol |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
739 |
] ensure:[ |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
740 |
self resources do:[:each | |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
741 |
each reset |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
742 |
] |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
743 |
] |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
744 |
! |
103 | 745 |
|
222 | 746 |
failureLog |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
747 |
^SUnitNameResolver class >> #defaultLogDevice |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
748 |
! |
103 | 749 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
750 |
isLogging |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
751 |
"By default, we're not logging failures. If you override this in |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
752 |
a subclass, make sure that you override #failureLog" |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
753 |
^false |
222 | 754 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
755 |
! |
103 | 756 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
757 |
logFailure: aString |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
758 |
self isLogging ifTrue: [ |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
759 |
self failureLog |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
760 |
cr; |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
761 |
nextPutAll: aString; |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
762 |
flush] |
222 | 763 |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
764 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
765 |
|
550 | 766 |
logSkipped: aString |
767 |
self isLogging ifTrue: [ |
|
768 |
self failureLog |
|
769 |
cr; |
|
770 |
nextPutAll: aString; |
|
771 |
flush] |
|
772 |
! |
|
773 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
774 |
openDebuggerOnFailingTestMethod |
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
775 |
"SUnit has halted one step in front of the failing test method. Step over the 'self halt' and |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
776 |
send into 'self perform: testSelector' to see the failure from the beginning" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
777 |
|
331
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
778 |
self |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
779 |
"/halt; |
ea59d5e02844
moved: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
780 |
performTest |
222 | 781 |
|
782 |
"Modified: / 05-12-2009 / 18:40:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
67 | 783 |
! |
784 |
||
785 |
run |
|
262
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
786 |
|
461
c4a68cc4e547
use TestResultForSTX in SUnit runner
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
787 |
^self run: TestResult defaultResultClass new |
262
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
788 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
789 |
"Modified: / 29-07-2011 / 12:07:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
67 | 790 |
! |
791 |
||
792 |
run: aResult |
|
262
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
793 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
794 |
^self run: aResult beforeEachDo: [:test :result|] afterEachDo: [:test :result|] |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
795 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
796 |
"Modified: / 29-07-2011 / 12:07:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
67 | 797 |
! |
798 |
||
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
799 |
run: aResult afterEachDo:block2 |
262
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
800 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
801 |
^self run: aResult beforeEachDo: [:test :result|] afterEachDo:block2 |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
802 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
803 |
"Modified: / 29-07-2011 / 12:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
804 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
805 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
806 |
run: aResult beforeEachDo:block1 afterEachDo:block2 |
262
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
807 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
808 |
^self run: aResult beforeEachDo:block1 afterEachDo:block2 resetResources: true |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
809 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
810 |
"Modified: / 29-07-2011 / 12:06:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
811 |
! |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
812 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
813 |
run: result beforeEachDo: before afterEachDo: after resetResources: reset |
430 | 814 |
^ self |
815 |
run: result |
|
816 |
beforeEachDo: before |
|
817 |
afterEachDo: after |
|
818 |
resetResources: reset |
|
819 |
debug: false |
|
820 |
||
821 |
"Created: / 29-07-2011 / 12:04:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
822 |
"Modified: / 21-08-2011 / 17:45:17 / cg" |
|
823 |
! |
|
824 |
||
825 |
run: result beforeEachDo: before afterEachDo: after resetResources: reset debug:doDebug |
|
262
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
826 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
827 |
"Workhorse for running a testcase. If reset is true, then |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
828 |
the resources are reset, otherwise not" |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
829 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
830 |
"1. Execute before block" |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
831 |
"This code is ugly in Smalltalk/X but it is so because |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
832 |
it is more portable - numArgs in ANSI (?)" |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
833 |
before numArgs == 2 ifTrue:[ |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
834 |
before value: self value: result |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
835 |
] ifFalse:[ |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
836 |
before numArgs == 1 ifTrue:[ |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
837 |
before value: self |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
838 |
] ifFalse:[ |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
839 |
before value. |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
840 |
] |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
841 |
]. |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
842 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
843 |
"2. Run the testcase" |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
844 |
reset ifTrue:[ |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
845 |
[ |
430 | 846 |
result runCase: self debugged:doDebug |
262
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
847 |
] sunitEnsure: [ |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
848 |
TestResource resetResources: self resources |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
849 |
]. |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
850 |
] ifFalse:[ |
430 | 851 |
result runCase: self debugged:doDebug |
262
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
852 |
]. |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
853 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
854 |
"3. Execute after block" |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
855 |
"This code is ugly in Smalltalk/X but it is so because |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
856 |
it is more portable - numArgs in ANSI (?)" |
282
deb55165e73b
changed: #run:beforeEachDo:afterEachDo:resetResources:
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
857 |
after numArgs == 2 ifTrue:[ |
deb55165e73b
changed: #run:beforeEachDo:afterEachDo:resetResources:
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
858 |
after value: self value: result |
262
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
859 |
] ifFalse:[ |
282
deb55165e73b
changed: #run:beforeEachDo:afterEachDo:resetResources:
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
860 |
after numArgs == 1 ifTrue:[ |
deb55165e73b
changed: #run:beforeEachDo:afterEachDo:resetResources:
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
861 |
after value: self |
262
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
862 |
] ifFalse:[ |
282
deb55165e73b
changed: #run:beforeEachDo:afterEachDo:resetResources:
Claus Gittinger <cg@exept.de>
parents:
265
diff
changeset
|
863 |
after value. |
262
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
864 |
] |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
865 |
]. |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
866 |
^result |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
867 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
868 |
"Created: / 29-07-2011 / 12:04:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
430 | 869 |
"Created: / 21-08-2011 / 17:44:56 / cg" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
870 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
871 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
872 |
run: aResult beforeEachTestCaseDo:block1 afterEachTestCaseDo:block2 |
262
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
873 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
874 |
<resource: #obsolete> |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
875 |
self obsoleteMethodWarning: 'Use #run:beforeEachDo:afterEachDo: instead'. |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
876 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
877 |
^self run: aResult beforeEachDo:block1 afterEachDo:block2 |
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
878 |
|
3c46acd3f64a
TestSuite/TestCase run* method refactored (cleanup, possible bug fixes)
vrany
parents:
254
diff
changeset
|
879 |
"Modified: / 29-07-2011 / 12:06:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
880 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
881 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
882 |
runCase |
570 | 883 |
|didSetup| |
884 |
||
328
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
885 |
self resources do: [:each | each availableFor: self]. |
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
886 |
|
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
887 |
[ |
570 | 888 |
didSetup := false. |
328
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
889 |
self setUp. |
570 | 890 |
didSetup := true. |
377 | 891 |
self performTest. |
328
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
892 |
] sunitEnsure: [ |
576 | 893 |
didSetup ifTrue:[ self safeTearDown ] |
328
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
894 |
] |
66cae160c956
added: #withStandardOutputAndTranscriptRedirectedDo:
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
895 |
|
377 | 896 |
"Modified (comment): / 18-08-2011 / 20:35:20 / cg" |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
897 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
898 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
899 |
runCaseAsFailure |
570 | 900 |
self setUp. |
901 |
[ |
|
576 | 902 |
[self openDebuggerOnFailingTestMethod] ensure: [self safeTearDown] |
570 | 903 |
] fork |
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
904 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
905 |
"Modified: / 21.6.2000 / 10:04:33 / Sames" |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
906 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
907 |
|
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
908 |
runCaseAsFailure: aSemaphore |
570 | 909 |
[ |
910 |
|didSetup| |
|
911 |
||
912 |
didSetup := false. |
|
913 |
self resources do: [:each | each availableFor: self]. |
|
914 |
[ |
|
915 |
self setUp. |
|
916 |
didSetup := true. |
|
917 |
self openDebuggerOnFailingTestMethod |
|
918 |
] sunitEnsure: [ |
|
919 |
didSetup ifTrue:[ self tearDown ] |
|
920 |
] |
|
921 |
] sunitEnsure: [aSemaphore signal]. |
|
139
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
922 |
! |
5a48f282d789
back to 1.42 - last checked in version was bogus
Claus Gittinger <cg@exept.de>
parents:
138
diff
changeset
|
923 |
|
67 | 924 |
setUp |
454 | 925 |
"can be redefined in a concrete test" |
67 | 926 |
! |
927 |
||
928 |
tearDown |
|
454 | 929 |
"can be redefined in a concrete test" |
50 | 930 |
! ! |
931 |
||
12 | 932 |
!TestCase class methodsFor:'documentation'! |
933 |
||
290 | 934 |
version |
578 | 935 |
^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.102 2013-04-28 13:41:55 cg Exp $' |
290 | 936 |
! |
937 |
||
203 | 938 |
version_CVS |
578 | 939 |
^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.102 2013-04-28 13:41:55 cg Exp $' |
222 | 940 |
! |
941 |
||
942 |
version_SVN |
|
943 |
^ '§Id: TestCase.st 218 2011-06-13 15:45:06Z vranyj1 §' |
|
12 | 944 |
! ! |
81 | 945 |
|
550 | 946 |
|
2 | 947 |
TestCase initialize! |