author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 14 Nov 2014 08:46:42 +0100 | |
changeset 14831 | 17e27adfbd3d |
parent 14739 | ec549f688c75 |
child 15008 | 6bb5b292ad5c |
permissions | -rw-r--r-- |
14728 | 1 |
" |
2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
|
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
4 |
||
5 |
Permission is hereby granted, free of charge, to any person |
|
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
25 |
" |
|
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
AbstractTestRunner subclass:#TestRunnerMini |
|
31 |
instanceVariableNames:'runnerPanel selectedClassesHolder selectedProtocolsHolder |
|
32 |
selectedMethodsHolder methodGeneratorHolder resultHolder |
|
33 |
resultInfoHolder resultBackgroundColorHolder runningHolder |
|
34 |
progressHolder progressIndicatorShownHolder infoHolder |
|
35 |
testProcess allTestCases progressIndicator' |
|
36 |
classVariableNames:'' |
|
37 |
poolDictionaries:'' |
|
38 |
category:'SUnit-UI' |
|
39 |
! |
|
40 |
||
41 |
Object subclass:#SuiteAndResult |
|
42 |
instanceVariableNames:'suite result' |
|
43 |
classVariableNames:'' |
|
44 |
poolDictionaries:'' |
|
45 |
privateIn:TestRunnerMini |
|
46 |
! |
|
47 |
||
48 |
!TestRunnerMini class methodsFor:'documentation'! |
|
49 |
||
50 |
copyright |
|
51 |
" |
|
52 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
|
53 |
Copyright (c) 2009-2010 eXept Software AG |
|
54 |
||
55 |
Permission is hereby granted, free of charge, to any person |
|
56 |
obtaining a copy of this software and associated documentation |
|
57 |
files (the 'Software'), to deal in the Software without |
|
58 |
restriction, including without limitation the rights to use, |
|
59 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
60 |
copies of the Software, and to permit persons to whom the |
|
61 |
Software is furnished to do so, subject to the following |
|
62 |
conditions: |
|
63 |
||
64 |
The above copyright notice and this permission notice shall be |
|
65 |
included in all copies or substantial portions of the Software. |
|
66 |
||
67 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
68 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
69 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
70 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
71 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
72 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
73 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
74 |
OTHER DEALINGS IN THE SOFTWARE. |
|
75 |
" |
|
76 |
! |
|
77 |
||
78 |
documentation |
|
79 |
" |
|
80 |
a tiny runner to be embedded in a system browser |
|
81 |
" |
|
82 |
! ! |
|
83 |
||
84 |
!TestRunnerMini class methodsFor:'help specs'! |
|
85 |
||
86 |
flyByHelpSpec |
|
87 |
"This resource specification was automatically generated |
|
88 |
by the UIHelpTool of ST/X." |
|
89 |
||
90 |
"Do not manually edit this!! If it is corrupted, |
|
91 |
the UIHelpTool may not be able to read the specification." |
|
92 |
||
93 |
" |
|
94 |
UIHelpTool openOnClass:Tools::TestRunnerEmbedded |
|
95 |
" |
|
96 |
||
97 |
<resource: #help> |
|
98 |
||
99 |
^ super flyByHelpSpec addPairsFrom:#( |
|
100 |
||
101 |
#debugSelected |
|
102 |
'Run the selected test(s) with debugging enabled' |
|
103 |
||
104 |
#runAll |
|
105 |
'Run all tests' |
|
106 |
||
107 |
#runFailed |
|
108 |
'Only rerun failed tests' |
|
109 |
||
110 |
#runSelected |
|
111 |
'Run the selected test(s)' |
|
112 |
||
113 |
#stopRun |
|
114 |
'Stop the test-run' |
|
115 |
||
116 |
) |
|
117 |
||
118 |
"Created: / 04-06-2012 / 19:27:47 / cg" |
|
119 |
! ! |
|
120 |
||
121 |
!TestRunnerMini class methodsFor:'image specs'! |
|
122 |
||
123 |
pinIcon |
|
124 |
"This resource specification was automatically generated |
|
125 |
by the ImageEditor of ST/X." |
|
126 |
||
127 |
"Do not manually edit this!! If it is corrupted, |
|
128 |
the ImageEditor may not be able to read the specification." |
|
129 |
||
130 |
" |
|
131 |
self pinIcon inspect |
|
132 |
ImageEditor openOnClass:self andSelector:#pinIcon |
|
133 |
Icon flushCachedIcons |
|
134 |
" |
|
135 |
||
136 |
<resource: #image> |
|
137 |
||
138 |
^Icon |
|
139 |
constantNamed:'Tools::TestRunnerEmbedded pinIcon' |
|
140 |
ifAbsentPut:[(Depth8Image new) width:14; height:13; bits:(ByteArray fromPackedString:' |
|
141 |
NC 8NC 8NC 8NB8/L# 8NC 8NC 8NC 8J3@1L# 8NC 8NC 8NB80J3@/APXDB@8OB3L+L3L0KB8RD1TVE1$ZJ2<0L2,8N@TGA@$JD@00KR<-M3 8M04MCP4M |
|
142 |
CPD0KSL7NC 7CRD\HRDAHRD!!HS\8NCXMH!!4"H!!4TGQ4#M# 8M@4[IRP^IQ8XIRT5NC *CRX_I!!<_I!!<QG2$8N@LMI2 ''HB\ HB\ @# 8@@@@@@@@@@@@@@@@ |
|
143 |
NC b') ; colorMapFromArray:#[136 149 174 23 50 93 145 154 169 144 154 168 48 116 186 68 118 170 70 119 171 70 120 171 62 133 196 62 132 195 93 155 206 170 202 228 171 202 228 197 223 244 93 156 206 132 180 218 132 181 218 205 228 246 90 156 204 111 182 226 179 216 240 88 182 232 115 196 236 153 212 241 186 225 246 189 226 245 217 238 249 242 251 255 235 249 255 238 250 255 241 251 255 245 252 255 248 253 255 235 250 255 238 251 255 239 251 255 241 252 255 242 252 255 245 253 255 248 254 255 247 254 255 157 161 160 157 162 160 0 114 54 0 97 46 0 82 39 0 149 62 53 155 88 114 182 73 125 181 81 163 202 129 159 167 110 170 170 151 171 169 151 183 177 142 191 182 136 255 255 255]; mask:((Depth1Image new) width:14; height:13; bits:(ByteArray fromPackedString:'@C @O@A<??3?<O?0??C?<O?0??C?<O?0??@b') ; yourself); yourself] |
|
144 |
! ! |
|
145 |
||
146 |
!TestRunnerMini class methodsFor:'interface specs'! |
|
147 |
||
148 |
windowSpec |
|
149 |
"This resource specification was automatically generated |
|
150 |
by the UIPainter of ST/X." |
|
151 |
||
152 |
"Do not manually edit this!! If it is corrupted, |
|
153 |
the UIPainter may not be able to read the specification." |
|
154 |
||
155 |
" |
|
156 |
UIPainter new openOnClass:Tools::TestRunnerMini andSelector:#windowSpec |
|
157 |
Tools::TestRunnerMini new openInterface:#windowSpec |
|
158 |
Tools::TestRunnerMini open |
|
159 |
" |
|
160 |
||
161 |
<resource: #canvas> |
|
162 |
||
163 |
^ |
|
164 |
#(FullSpec |
|
165 |
name: windowSpec |
|
166 |
window: |
|
167 |
(WindowSpec |
|
14831
17e27adfbd3d
Changed title of Tools::TestRunnerMini
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14739
diff
changeset
|
168 |
label: 'Mini Test Runner' |
17e27adfbd3d
Changed title of Tools::TestRunnerMini
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14739
diff
changeset
|
169 |
name: 'Mini Test Runner' |
14728 | 170 |
min: (Point 10 10) |
171 |
bounds: (Rectangle 0 0 600 50) |
|
172 |
) |
|
173 |
component: |
|
174 |
(SpecCollection |
|
175 |
collection: ( |
|
176 |
(HorizontalPanelViewSpec |
|
177 |
name: 'RunnerInnerBox' |
|
178 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
179 |
backgroundChannel: resultBackgroundColorAspect |
|
180 |
horizontalLayout: rightSpaceFit |
|
181 |
verticalLayout: center |
|
182 |
horizontalSpace: 0 |
|
183 |
elementsChangeSize: true |
|
184 |
component: |
|
185 |
(SpecCollection |
|
186 |
collection: ( |
|
187 |
(ViewSpec |
|
188 |
name: 'RunnerInfoBox' |
|
189 |
backgroundChannel: resultBackgroundColorAspect |
|
190 |
component: |
|
191 |
(SpecCollection |
|
192 |
collection: ( |
|
193 |
(LabelSpec |
|
194 |
label: 'Run tests first!!' |
|
195 |
name: 'ResultName' |
|
196 |
layout: (LayoutFrame 22 0 0 0 0 1 -10 1) |
|
197 |
backgroundChannel: resultBackgroundColorAspect |
|
198 |
foregroundColor: (Color 100.0 100.0 100.0) |
|
199 |
translateLabel: true |
|
200 |
labelChannel: resultNameAspect |
|
201 |
adjust: left |
|
202 |
) |
|
203 |
(ActionButtonSpec |
|
204 |
name: 'Button3' |
|
205 |
layout: (LayoutFrame 5 0 3 0 21 0 17 0) |
|
206 |
level: 0 |
|
207 |
visibilityChannel: pinButtonVisibleHolder |
|
208 |
backgroundChannel: resultBackgroundColorAspect |
|
209 |
hasCharacterOrientedLabel: false |
|
210 |
translateLabel: true |
|
211 |
foregroundChannel: resultBackgroundColorAspect |
|
212 |
labelChannel: pinIcon |
|
213 |
model: pin |
|
214 |
) |
|
215 |
(LabelSpec |
|
216 |
name: 'ResultInfo' |
|
217 |
layout: (LayoutFrame 22 0 -10 1 0 1 0 1) |
|
218 |
style: (FontDescription helvetica medium roman 8 #'iso10646-1') |
|
219 |
backgroundChannel: resultBackgroundColorAspect |
|
220 |
foregroundColor: (Color 100.0 100.0 100.0) |
|
221 |
translateLabel: true |
|
222 |
labelChannel: resultInfoAspect |
|
223 |
adjust: left |
|
224 |
) |
|
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
225 |
(ViewSpec |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
226 |
name: 'ProgressPanel' |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
227 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
228 |
initiallyInvisible: true |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
229 |
visibilityChannel: progressIndicatorShownHolder |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
230 |
backgroundChannel: resultBackgroundColorAspect |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
231 |
component: |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
232 |
(SpecCollection |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
233 |
collection: ( |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
234 |
(ProgressIndicatorSpec |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
235 |
name: 'RunningProgress' |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
236 |
layout: (LayoutFrame 5 0 -10 0.5 -5 1 10 0.5) |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
237 |
model: progressHolder |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
238 |
postBuildCallback: postBuildProgressIndicator: |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
239 |
) |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
240 |
) |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
241 |
|
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
242 |
) |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
243 |
) |
14728 | 244 |
) |
245 |
||
246 |
) |
|
247 |
extent: (Point 296 30) |
|
248 |
) |
|
249 |
(ActionButtonSpec |
|
250 |
label: 'Debug' |
|
251 |
name: 'DebugButton' |
|
252 |
activeHelpKey: debugSelected |
|
253 |
translateLabel: true |
|
254 |
model: debug |
|
255 |
enableChannel: runEnabledHolder |
|
256 |
extent: (Point 60 25) |
|
257 |
) |
|
258 |
(ActionButtonSpec |
|
259 |
label: 'Stop' |
|
260 |
name: 'Button2' |
|
261 |
activeHelpKey: stopRun |
|
262 |
visibilityChannel: runningHolder |
|
263 |
translateLabel: true |
|
264 |
model: stop |
|
265 |
extent: (Point 60 25) |
|
266 |
) |
|
267 |
(ActionButtonSpec |
|
268 |
label: 'Run' |
|
269 |
name: 'Run' |
|
270 |
activeHelpKey: runSelected |
|
271 |
visibilityChannel: notRunningHolder |
|
272 |
translateLabel: true |
|
273 |
model: run |
|
274 |
enableChannel: runEnabledHolder |
|
275 |
extent: (Point 60 25) |
|
276 |
) |
|
277 |
(ActionButtonSpec |
|
278 |
label: ' Failed' |
|
279 |
name: 'Button1' |
|
280 |
activeHelpKey: runFailed |
|
281 |
visibilityChannel: runFailedButtonVisibleHolder |
|
282 |
translateLabel: true |
|
283 |
model: runFailed |
|
284 |
enableChannel: runFailedEnabledHolder |
|
285 |
extent: (Point 60 25) |
|
286 |
) |
|
287 |
(ActionButtonSpec |
|
288 |
label: 'Run all' |
|
289 |
name: 'RunAll' |
|
290 |
activeHelpKey: runAll |
|
291 |
visibilityChannel: runAllButtonVisibleHolder |
|
292 |
translateLabel: true |
|
293 |
model: runAll |
|
294 |
enableChannel: runAllEnabledHolder |
|
295 |
extent: (Point 60 25) |
|
296 |
) |
|
297 |
(ViewSpec |
|
298 |
name: 'Spacer' |
|
299 |
backgroundChannel: resultBackgroundColorAspect |
|
300 |
extent: (Point 5 50) |
|
301 |
) |
|
302 |
) |
|
303 |
||
304 |
) |
|
305 |
postBuildCallback: postBuildRunnerPanel: |
|
306 |
) |
|
307 |
) |
|
308 |
||
309 |
) |
|
310 |
) |
|
311 |
||
312 |
! ! |
|
313 |
||
314 |
!TestRunnerMini class methodsFor:'queries'! |
|
315 |
||
316 |
shouldRememberLastExtent |
|
317 |
"to be redefined by concrete applications: |
|
318 |
if true is answered, the application's extent is remembered on close |
|
319 |
and used as a default when opened the next time" |
|
320 |
||
321 |
^ false |
|
322 |
||
323 |
"Created: / 22-09-2014 / 14:02:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
324 |
! ! |
|
325 |
||
326 |
!TestRunnerMini methodsFor:'accessing'! |
|
327 |
||
328 |
allTestCases |
|
329 |
allTestCases isNil ifTrue:[ |
|
330 |
self updateTestCases |
|
331 |
]. |
|
332 |
^ allTestCases |
|
333 |
! |
|
334 |
||
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
335 |
allTestCases:something |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
336 |
allTestCases := something. |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
337 |
! |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
338 |
|
14728 | 339 |
infoHolder:something |
340 |
"to show something in the browsers info area (near the bottom" |
|
341 |
||
342 |
infoHolder := something. |
|
343 |
||
344 |
"Created: / 05-07-2011 / 16:22:24 / cg" |
|
345 |
! |
|
346 |
||
347 |
selectedTestMethods |
|
348 |
||
349 |
| selectedClass | |
|
350 |
selectedClass := self theSingleTestCase. |
|
351 |
||
352 |
^ (self selectedMethodsHolder value ? #()) select: |
|
353 |
[:mthd | | cls | |
|
354 |
(cls := selectedClass) isNil ifTrue:[cls := mthd mclass]. |
|
355 |
(self isTestCaseLike:selectedClass) |
|
356 |
and:[ selectedClass isTestSelector:mthd selector ] ] |
|
357 |
||
358 |
"Created: / 15-03-2010 / 13:21:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
359 |
"Modified: / 22-07-2011 / 15:46:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
360 |
"Modified: / 02-08-2011 / 17:46:38 / cg" |
|
361 |
! |
|
362 |
||
363 |
selectedTestMethodsFromProtocols:protocols |
|
364 |
||
365 |
|methods generator selectedClass| |
|
366 |
||
367 |
methods := Set new. |
|
368 |
generator := self methodGeneratorHolder value. |
|
369 |
selectedClass := self theSingleTestCase. |
|
370 |
||
371 |
generator notNil ifTrue:[ |
|
372 |
generator do: [:cls :cat :sel :mthd | |
|
373 |
(mthd notNil |
|
374 |
and:[ (self isTestCaseLike:(selectedClass ? cls)) |
|
375 |
and:[ (selectedClass ? cls) isTestSelector:sel ] ]) |
|
376 |
ifTrue:[ methods add:mthd ] |
|
377 |
] |
|
378 |
] ifFalse:[ |
|
379 |
allTestCases do: [:cls | |
|
380 |
cls methodsDo: [:mthd | |
|
381 |
((protocols includes:mthd category) and:[ cls isTestSelector:mthd selector ]) |
|
382 |
ifTrue:[ |
|
383 |
methods add:mthd |
|
384 |
] |
|
385 |
] |
|
386 |
] |
|
387 |
]. |
|
388 |
^ methods |
|
389 |
||
390 |
"Created: / 15-03-2010 / 19:50:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
391 |
"Modified: / 22-07-2011 / 15:53:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
392 |
"Modified (format): / 04-06-2012 / 19:05:32 / cg" |
|
393 |
! |
|
394 |
||
395 |
selectedTestMethodsFromProtocols:protocols inClass:aTestClass |
|
396 |
||
397 |
|methods generator| |
|
398 |
||
399 |
methods := Set new. |
|
400 |
generator := self methodGeneratorHolder value. |
|
401 |
||
402 |
generator notNil ifTrue:[ |
|
403 |
generator do: [:cls :cat :sel :mthd | |
|
404 |
(mthd notNil |
|
405 |
and:[ (self isTestCaseLike:(aTestClass ? cls)) |
|
406 |
and:[ (aTestClass ? cls) isTestSelector:sel ] ]) |
|
407 |
ifTrue:[ methods add:mthd ] |
|
408 |
] |
|
409 |
] ifFalse:[ |
|
410 |
self allTestCases do: [:cls | |
|
411 |
cls methodsDo: [:mthd | |
|
412 |
((protocols includes:mthd category) and:[ cls isTestSelector:mthd selector ]) |
|
413 |
ifTrue:[ |
|
414 |
methods add:mthd |
|
415 |
] |
|
416 |
] |
|
417 |
] |
|
418 |
]. |
|
419 |
^ methods |
|
420 |
||
421 |
"Created: / 15-03-2010 / 19:50:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
422 |
"Modified: / 22-07-2011 / 15:53:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
423 |
"Modified (format): / 04-06-2012 / 19:05:32 / cg" |
|
424 |
! |
|
425 |
||
426 |
selectedTestMethodsInClass:testClass |
|
427 |
^ (self selectedMethodsHolder value ? #()) select: |
|
428 |
[:mthd | | cls | |
|
429 |
(cls := testClass) isNil ifTrue:[cls := mthd mclass]. |
|
430 |
(self isTestCaseLike:testClass) |
|
431 |
and:[ testClass isTestSelector:mthd selector ] ] |
|
432 |
||
433 |
"Created: / 15-03-2010 / 13:21:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
434 |
"Modified: / 22-07-2011 / 15:46:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
435 |
"Modified: / 02-08-2011 / 17:46:38 / cg" |
|
436 |
! |
|
437 |
||
438 |
theSingleTestCase |
|
439 |
||
440 |
self allTestCases isEmptyOrNil ifTrue:[^nil]. |
|
441 |
allTestCases size > 1 ifTrue:[^nil]. |
|
442 |
||
443 |
^allTestCases anyOne. |
|
444 |
||
445 |
"Created: / 22-07-2011 / 15:44:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
446 |
! ! |
|
447 |
||
448 |
!TestRunnerMini methodsFor:'actions'! |
|
449 |
||
450 |
debug |
|
451 |
| suiteAndResult suite result | |
|
452 |
||
453 |
suiteAndResult := self resultHolder value. |
|
454 |
suite := suiteAndResult suiteForRun. |
|
455 |
"/ suite tests size ~= 1 ifTrue:[^self breakPoint: #jv]. |
|
456 |
"/ test := suiteAndResult suite tests anyOne. |
|
457 |
result := TestResult defaultResultClass new. |
|
458 |
suiteAndResult := SuiteAndResult suite: suite result: result. |
|
459 |
||
460 |
self stop. |
|
461 |
||
462 |
"/ debug run is synchronous |
|
463 |
[ |
|
464 |
self runningHolder value:true. |
|
465 |
||
466 |
suite tests do:[:test | |
|
467 |
[ |
|
468 |
test debug. |
|
469 |
] ifCurtailed:[ |
|
470 |
result failureOutcomes add: test. |
|
471 |
self resultHolder value:suiteAndResult; changed. |
|
472 |
]. |
|
473 |
||
474 |
(test class testSelectorPassed:test selector) ifTrue:[ |
|
475 |
"/ result := TestResult defaultResultClass new. |
|
476 |
"/ result passed add: test. |
|
477 |
"/ suiteAndResult := SuiteAndResult suite: suite result: result. |
|
478 |
result passedOutcomes add: test. |
|
479 |
self resultHolder value:suiteAndResult; changed. |
|
480 |
] ifFalse:[ |
|
481 |
(test class testSelectorFailed:test selector) ifTrue:[ |
|
482 |
"/ result := TestResult defaultResultClass new. |
|
483 |
"/ result failures add: test. |
|
484 |
"/ suiteAndResult := SuiteAndResult suite: suite result: result. |
|
485 |
result failureOutcomes add: test. |
|
486 |
self resultHolder value:suiteAndResult; changed. |
|
487 |
] |
|
488 |
] |
|
489 |
]. |
|
490 |
] ensure:[ |
|
491 |
self runningHolder value:false. |
|
492 |
]. |
|
493 |
||
494 |
"Created: / 15-03-2010 / 15:43:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
495 |
"Modified: / 07-07-2011 / 11:33:48 / Jan Vrany <jan.vrant@fit.cvut,cz>" |
|
496 |
"Modified: / 04-06-2012 / 19:46:38 / cg" |
|
497 |
"Modified: / 03-12-2012 / 14:02:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
498 |
! |
|
499 |
||
500 |
pin |
|
501 |
| runner screen | |
|
502 |
||
503 |
runner := TestRunnerMini new. |
|
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
504 |
runner resultHolder value: self resultHolder value copy. |
14728 | 505 |
|
506 |
runner allButOpen. |
|
507 |
||
508 |
screen := Screen current. |
|
509 |
(screen notNil and:[ screen platformName == #X11 ]) ifTrue:[ |
|
510 |
"/ Use EWMH hint to tell the WM that the window is |
|
511 |
"/ a sort of floating tool so WM can decorate it according to |
|
512 |
"/ DE standards. |
|
513 |
runner window id isNil ifTrue:[ |
|
514 |
runner window create. |
|
515 |
]. |
|
516 |
screen setWindowType:#'_NET_WM_WINDOW_TYPE_UTILITY' in:runner window id. |
|
517 |
]. |
|
518 |
runner open. |
|
519 |
||
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
520 |
"Modified: / 23-09-2014 / 12:05:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
14728 | 521 |
! |
522 |
||
523 |
run |
|
524 |
|suite| |
|
525 |
||
526 |
resultHolder value isNil ifTrue:[ |
|
527 |
suite := self suiteForRun |
|
528 |
] ifFalse:[ |
|
529 |
suite := resultHolder value suiteForRun |
|
530 |
]. |
|
531 |
self run:suite |
|
532 |
||
533 |
"Created: / 10-03-2010 / 19:42:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
534 |
"Modified: / 22-08-2011 / 09:58:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
535 |
"Modified: / 09-10-2011 / 10:56:39 / cg" |
|
536 |
! |
|
537 |
||
538 |
run:suite |
|
539 |
^self run: suite debug: false |
|
540 |
||
541 |
"Created: / 11-03-2010 / 10:22:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
542 |
"Modified: / 09-06-2012 / 20:23:58 / cg" |
|
543 |
"Modified: / 03-12-2012 / 13:59:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
544 |
! |
|
545 |
||
546 |
run:suite debug: debug |
|
547 |
|suiteAndResult numTests| |
|
548 |
||
549 |
numTests := suite tests size. |
|
550 |
numTests == 0 ifTrue:[ |
|
551 |
^ self |
|
552 |
]. |
|
553 |
||
554 |
self stop. |
|
555 |
||
556 |
testProcess := [ |
|
557 |
|result incr run| |
|
558 |
||
559 |
result := debug ifFalse:[TestResult new] ifTrue:[TestResultForRunWithDebug]. |
|
560 |
[ |
|
561 |
self runningHolder value:true. |
|
562 |
self progressIndicatorShownHolder value:(numTests > 1). |
|
563 |
self progressHolder value:0. |
|
564 |
incr := 100 / numTests. |
|
565 |
run := 0. |
|
566 |
result := suite |
|
567 |
run: result |
|
568 |
beforeEachDo:[:test :result | |
|
569 |
infoHolder notNil ifTrue:[ |
|
570 |
infoHolder value:('Running "%1-%2"...' |
|
571 |
bindWith:test name |
|
572 |
with:test getTestName allBold) |
|
573 |
] |
|
574 |
] |
|
575 |
afterEachDo:[:test :result | |
|
576 |
run := run + 1. |
|
577 |
self progressHolder value:(incr * run) truncated "rounded". |
|
578 |
infoHolder notNil ifTrue:[ |
|
579 |
infoHolder value:('Done.') |
|
580 |
] |
|
581 |
] |
|
582 |
debug: debug. |
|
583 |
suiteAndResult := SuiteAndResult suite:suite result:result. |
|
584 |
] ensure:[ |
|
585 |
self progressIndicatorShownHolder value:false. |
|
586 |
self resultHolder setValue:nil; value:suiteAndResult; changed. |
|
587 |
self runningHolder value:false. |
|
588 |
] |
|
589 |
] newProcess. |
|
590 |
||
591 |
testProcess priority:(Processor userBackgroundPriority). |
|
592 |
testProcess resume. |
|
593 |
||
594 |
"Created: / 03-12-2012 / 13:59:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
595 |
! |
|
596 |
||
597 |
runAll |
|
598 |
||
599 |
self run: (self suiteForRunAll). |
|
600 |
||
601 |
"Created: / 10-03-2010 / 19:42:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
602 |
"Modified: / 15-03-2010 / 13:12:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
603 |
"Modified: / 04-06-2012 / 19:00:14 / cg" |
|
604 |
! |
|
605 |
||
606 |
runFailed |
|
607 |
self run: self suiteForRunFailed. |
|
608 |
||
609 |
"Created: / 04-06-2012 / 18:32:19 / cg" |
|
610 |
! |
|
611 |
||
612 |
runWithDebug |
|
613 |
"/ cg: I really do not want to run them twice to get a debugger |
|
614 |
"/ - I want to run them either with a debugger coming right away, or not. |
|
615 |
||
616 |
| suiteAndResult suite| |
|
617 |
||
618 |
suiteAndResult := self resultHolder value. |
|
619 |
suiteAndResult isNil ifTrue:[ |
|
620 |
suite := self suiteForRun. |
|
621 |
] ifFalse:[ |
|
622 |
suite := suiteAndResult suiteForRun. |
|
623 |
]. |
|
624 |
||
625 |
self run: suite debug: true |
|
626 |
||
627 |
||
628 |
||
629 |
"/ suiteAndResult suite tests size ~= 1 ifTrue:[^self breakPoint: #jv]. |
|
630 |
"/ [suiteAndResult suite tests anyOne debug] fork |
|
631 |
||
632 |
"Created: / 05-07-2011 / 18:45:43 / cg" |
|
633 |
"Modified: / 09-10-2011 / 10:55:46 / cg" |
|
634 |
"Modified: / 03-12-2012 / 13:59:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
635 |
! |
|
636 |
||
637 |
stop |
|
638 |
|p| |
|
639 |
||
640 |
(p := testProcess) notNil ifTrue:[ |
|
641 |
testProcess := nil. |
|
642 |
p terminate |
|
643 |
]. |
|
644 |
||
645 |
"Created: / 04-06-2012 / 18:34:07 / cg" |
|
646 |
! ! |
|
647 |
||
648 |
!TestRunnerMini methodsFor:'aspects'! |
|
649 |
||
650 |
debugVisibleAspect |
|
651 |
^ BlockValue |
|
652 |
with:[:model | |
|
653 |
model notNil |
|
654 |
and:[ model testCount == 1 |
|
655 |
and:[ model hasFailuresOrErrors ]] |
|
656 |
] |
|
657 |
argument:self resultHolder |
|
658 |
||
659 |
"Created: / 15-03-2010 / 15:40:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
660 |
"Modified: / 02-08-2011 / 18:19:14 / cg" |
|
661 |
! |
|
662 |
||
663 |
notRunningHolder |
|
664 |
^ BlockValue forLogicalNot:(self runningHolder) |
|
665 |
||
666 |
"Created: / 04-06-2012 / 18:38:48 / cg" |
|
667 |
! |
|
668 |
||
669 |
progressHolder |
|
670 |
"return/create the 'progressHolder' value holder (automatically generated)" |
|
671 |
||
672 |
progressHolder isNil ifTrue:[ |
|
673 |
progressHolder := ValueHolder new. |
|
674 |
]. |
|
675 |
^ progressHolder |
|
676 |
! |
|
677 |
||
678 |
progressIndicatorShownHolder |
|
679 |
progressIndicatorShownHolder isNil ifTrue:[ |
|
680 |
progressIndicatorShownHolder := ValueHolder with: false. |
|
681 |
]. |
|
682 |
^ progressIndicatorShownHolder |
|
683 |
||
684 |
"Modified: / 15-03-2010 / 20:29:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
685 |
"Modified (comment): / 04-06-2012 / 18:38:52 / cg" |
|
686 |
"Created: / 04-06-2012 / 19:42:59 / cg" |
|
687 |
! |
|
688 |
||
689 |
resultBackgroundColorAspect |
|
690 |
<resource: #uiAspect> |
|
691 |
resultBackgroundColorHolder isNil ifTrue:[ |
|
692 |
resultBackgroundColorHolder := BlockValue |
|
693 |
with:[:result :running | |
|
694 |
running ifTrue:[ |
|
695 |
self class currentlyRunningColor |
|
696 |
"/ View defaultBackgroundColor |
|
697 |
] ifFalse:[ |
|
698 |
result isNil ifTrue:[ |
|
699 |
self class notRunColor |
|
700 |
] ifFalse:[ |
|
701 |
result color |
|
702 |
] |
|
703 |
]. |
|
704 |
] |
|
705 |
argument:self resultHolder |
|
706 |
argument:self runningHolder. |
|
707 |
resultBackgroundColorHolder |
|
708 |
onChangeEvaluate:[ |
|
709 |
runnerPanel notNil ifTrue:[ |
|
710 |
runnerPanel backgroundColor:resultBackgroundColorHolder value |
|
711 |
] |
|
712 |
]. |
|
713 |
]. |
|
714 |
^ resultBackgroundColorHolder. |
|
715 |
||
716 |
"Created: / 15-03-2010 / 15:22:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
717 |
"Modified: / 04-06-2012 / 19:40:11 / cg" |
|
718 |
"Modified: / 23-09-2014 / 09:46:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
719 |
! |
|
720 |
||
721 |
resultHolder |
|
722 |
"return/create the 'resultHolder' value holder (automatically generated)" |
|
723 |
||
724 |
resultHolder isNil ifTrue:[ |
|
725 |
resultHolder := ValueHolder new. |
|
726 |
]. |
|
727 |
^ resultHolder |
|
728 |
! |
|
729 |
||
730 |
resultInfoAspect |
|
731 |
^ BlockValue |
|
732 |
with:[:model | model isNil ifTrue:[ '' ] ifFalse:[ model info ] ] |
|
733 |
argument:self resultHolder |
|
734 |
||
735 |
"Created: / 15-03-2010 / 20:22:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
736 |
"Modified: / 02-08-2011 / 18:20:26 / cg" |
|
737 |
! |
|
738 |
||
739 |
resultNameAspect |
|
740 |
^ BlockValue |
|
741 |
with:[:model | model isNil ifTrue:[ 'Run the tests!!' ] ifFalse:[ model name ] ] |
|
742 |
argument:self resultHolder |
|
743 |
||
744 |
"Created: / 15-03-2010 / 14:57:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
745 |
"Modified: / 15-03-2010 / 20:17:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
746 |
"Modified: / 02-08-2011 / 18:20:38 / cg" |
|
747 |
! |
|
748 |
||
749 |
runAllEnabledHolder |
|
750 |
||
751 |
^ self notRunningHolder |
|
752 |
||
753 |
"Created: / 07-09-2010 / 09:15:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
754 |
"Modified: / 04-06-2012 / 18:40:46 / cg" |
|
755 |
! |
|
756 |
||
757 |
runEnabledHolder |
|
758 |
^BlockValue |
|
759 |
with: |
|
760 |
[:result :running | |
|
761 |
||
762 |
running not |
|
763 |
and:[ result notNil |
|
764 |
and:[ result testCount > 0 ]] |
|
765 |
] |
|
766 |
argument: self resultHolder |
|
767 |
argument: self runningHolder |
|
768 |
||
769 |
"Created: / 07-09-2010 / 09:15:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
770 |
"Modified: / 04-06-2012 / 18:52:41 / cg" |
|
771 |
! |
|
772 |
||
773 |
runFailedEnabledHolder |
|
774 |
^BlockValue |
|
775 |
with: |
|
776 |
[:running | |
|
777 |
||
778 |
|result| |
|
779 |
||
780 |
running not |
|
781 |
and:[ TestResult notNil |
|
782 |
and:[ TestResult isLoaded |
|
783 |
and:[ result := self resultForSuite:self suiteForRunAll. result notNil |
|
784 |
and:[ result hasFailuresOrErrors ]]]] |
|
785 |
] |
|
786 |
"/ argument: self resultHolder |
|
787 |
argument: self runningHolder |
|
788 |
||
789 |
"Created: / 07-09-2010 / 09:15:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
790 |
"Created: / 04-06-2012 / 18:28:12 / cg" |
|
791 |
"Modified: / 18-07-2012 / 09:55:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
792 |
! |
|
793 |
||
794 |
runningHolder |
|
795 |
runningHolder isNil ifTrue:[ |
|
796 |
runningHolder := ValueHolder with: false. |
|
797 |
]. |
|
798 |
^ runningHolder |
|
799 |
||
800 |
"Modified: / 15-03-2010 / 20:29:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
801 |
"Modified (comment): / 04-06-2012 / 18:38:52 / cg" |
|
802 |
! |
|
803 |
||
804 |
stopEnabledHolder |
|
805 |
^ self runningHolder |
|
806 |
||
807 |
"Created: / 04-06-2012 / 18:29:01 / cg" |
|
808 |
! ! |
|
809 |
||
810 |
!TestRunnerMini methodsFor:'aspects-visibility'! |
|
811 |
||
812 |
pinButtonVisibleHolder |
|
813 |
^ false |
|
814 |
||
815 |
"Created: / 23-09-2014 / 10:11:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
816 |
! |
|
817 |
||
818 |
runAllButtonVisibleHolder |
|
819 |
^ false |
|
820 |
||
821 |
"Created: / 23-09-2014 / 10:12:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
822 |
! |
|
823 |
||
824 |
runFailedButtonVisibleHolder |
|
825 |
^ false |
|
826 |
||
827 |
"Created: / 23-09-2014 / 10:12:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
828 |
! ! |
|
829 |
||
830 |
!TestRunnerMini methodsFor:'change & update'! |
|
831 |
||
832 |
invalidateSuiteAndResult |
|
833 |
self resultHolder value:nil. |
|
834 |
! |
|
835 |
||
836 |
update:aspect with:param from:sender |
|
837 |
||
838 |
sender == Smalltalk ifTrue:[ |
|
839 |
aspect == #lastTestRunResult ifTrue:[ |
|
840 |
allTestCases notNil ifTrue:[ |
|
841 |
(allTestCases includesIdentical: param first) ifTrue:[ |
|
842 |
self invalidateSuiteAndResult. "/ updateTestSuiteAndResult. |
|
843 |
self enqueueDelayedAction:[ self updateSuiteAndResult ]. |
|
844 |
^self |
|
845 |
] |
|
846 |
]. |
|
847 |
] |
|
848 |
]. |
|
849 |
super update:aspect with:param from:sender |
|
850 |
||
851 |
"Modified: / 23-09-2014 / 10:23:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
852 |
! |
|
853 |
||
854 |
updateSuiteAndResult |
|
855 |
| suite suiteAndResult | |
|
856 |
||
857 |
self runningHolder value ifTrue:[^self]. |
|
858 |
self allTestCases isEmptyOrNil ifTrue:[^self]. |
|
859 |
||
860 |
suiteAndResult := SuiteAndResult |
|
861 |
suite: (suite := self suiteForRun) |
|
862 |
result: (self resultForSuite: suite). |
|
863 |
self resultHolder value: suiteAndResult. |
|
864 |
||
865 |
"Created: / 15-03-2010 / 19:41:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
866 |
"Modified: / 15-03-2010 / 20:55:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
867 |
"Modified: / 04-06-2012 / 19:03:15 / cg" |
|
868 |
! |
|
869 |
||
870 |
updateTestCases |
|
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
871 |
"/ Nothing to do here |
14728 | 872 |
|
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
873 |
"Created: / 23-09-2014 / 12:02:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
14728 | 874 |
! |
875 |
||
876 |
updateTestSuiteAndResult |
|
877 |
||
878 |
| suite suiteAndResult | |
|
879 |
self runningHolder value ifTrue:[^self]. |
|
880 |
allTestCases isEmptyOrNil ifTrue:[^self]. |
|
881 |
suiteAndResult := SuiteAndResult |
|
882 |
suite: (suite := self suiteForRun) |
|
883 |
result: (self resultForSuite: suite). |
|
884 |
self resultHolder value: suiteAndResult. |
|
885 |
||
886 |
"Created: / 15-03-2010 / 19:41:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
887 |
"Modified: / 15-03-2010 / 20:55:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
888 |
"Modified: / 04-06-2012 / 19:03:15 / cg" |
|
889 |
! |
|
890 |
||
891 |
updateVisibility |
|
892 |
||
893 |
self hasTestCaseSelected |
|
894 |
ifTrue:[self show] |
|
895 |
ifFalse:[self hide] |
|
896 |
||
897 |
"Created: / 11-03-2010 / 09:02:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
898 |
! ! |
|
899 |
||
900 |
!TestRunnerMini methodsFor:'hooks'! |
|
901 |
||
902 |
commonPostOpen |
|
903 |
||
904 |
Smalltalk addDependent: self. |
|
905 |
||
906 |
"Created: / 17-11-2011 / 20:59:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
907 |
! |
|
908 |
||
909 |
postBuildRunnerPanel: aView |
|
910 |
||
911 |
runnerPanel := aView. |
|
912 |
runnerPanel backgroundColor: self resultBackgroundColorAspect value |
|
913 |
||
914 |
"Created: / 15-03-2010 / 14:26:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
915 |
! |
|
916 |
||
917 |
release |
|
918 |
||
919 |
Smalltalk removeDependent: self. |
|
920 |
||
921 |
"Created: / 23-09-2014 / 10:22:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
922 |
! |
|
923 |
||
924 |
releaseAsSubCanvas |
|
925 |
||
926 |
Smalltalk removeDependent: self. |
|
927 |
||
928 |
"Created: / 17-11-2011 / 21:03:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
929 |
! ! |
|
930 |
||
931 |
!TestRunnerMini methodsFor:'private'! |
|
932 |
||
933 |
isTestCaseLike:cls |
|
934 |
||
935 |
^(super isTestCaseLike: cls) and: |
|
936 |
[(cls askFor: #isAbstract) not] |
|
937 |
||
938 |
"Modified: / 04-03-2011 / 06:54:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
939 |
! |
|
940 |
||
941 |
postBuildProgressIndicator:aWidget |
|
942 |
progressIndicator := aWidget |
|
943 |
! ! |
|
944 |
||
945 |
!TestRunnerMini methodsFor:'queries'! |
|
946 |
||
947 |
hasTestCaseSelected |
|
948 |
||
949 |
^self allTestCases notEmptyOrNil |
|
950 |
||
951 |
"Created: / 11-03-2010 / 09:06:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
952 |
"Modified: / 15-03-2010 / 20:54:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
953 |
"Modified: / 04-08-2011 / 20:42:10 / cg" |
|
954 |
! ! |
|
955 |
||
956 |
!TestRunnerMini methodsFor:'utilities'! |
|
957 |
||
958 |
resultForSuite:suite |
|
959 |
|result| |
|
960 |
||
961 |
result := TestResult defaultResultClass new. |
|
962 |
suite tests do:[:test | |
|
963 |
| sel cls | |
|
964 |
||
965 |
sel := test selector. |
|
966 |
cls := test class. |
|
967 |
(cls testSelectorPassed:sel) ifTrue:[ |
|
968 |
result passedOutcomes add: (cls rememberedOutcomeFor: sel) |
|
969 |
] ifFalse:[ |
|
970 |
(cls testSelectorError:sel) ifTrue:[ |
|
971 |
result errorOutcomes add:(cls rememberedOutcomeFor: sel) |
|
972 |
] ifFalse:[ |
|
973 |
(cls testSelectorFailed:sel) ifTrue:[ |
|
974 |
result failureOutcomes add:(cls rememberedOutcomeFor: sel) |
|
975 |
] |
|
976 |
] |
|
977 |
] |
|
978 |
]. |
|
979 |
^ result |
|
980 |
||
981 |
"Created: / 15-03-2010 / 19:46:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
982 |
"Modified: / 02-08-2011 / 18:20:00 / cg" |
|
983 |
"Modified: / 20-08-2011 / 14:30:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
984 |
! |
|
985 |
||
986 |
suiteForRun |
|
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
987 |
^ self resultHolder value suiteForRun |
14728 | 988 |
|
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
989 |
"Modified: / 23-09-2014 / 12:07:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
14728 | 990 |
! |
991 |
||
992 |
suiteForRunAll |
|
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
993 |
"raise an error: must be redefined in concrete subclass(es)" |
14728 | 994 |
|
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
995 |
^ self suiteForRun |
14728 | 996 |
|
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
997 |
"Modified: / 23-09-2014 / 12:07:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
14728 | 998 |
! |
999 |
||
1000 |
suiteForRunFailed |
|
1001 |
|suite numTests| |
|
1002 |
||
1003 |
suite := TestSuite named:(self suiteNameFromClasses: self allTestCases). |
|
1004 |
numTests := 0. |
|
1005 |
||
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
1006 |
self suiteForRunAll tests do:[:eachTest | |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
1007 |
| sel cls | |
14728 | 1008 |
|
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
1009 |
sel := eachTest selector. |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
1010 |
cls := eachTest class. |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
1011 |
(cls testSelectorPassed:sel) ifFalse:[ |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
1012 |
suite addTest:eachTest. |
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
1013 |
numTests := numTests + 1. |
14728 | 1014 |
] |
1015 |
]. |
|
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
1016 |
|
14728 | 1017 |
numTests == 1 ifTrue:[ |
1018 |
suite name:(suite tests first selector) |
|
1019 |
] ifFalse:[ |
|
1020 |
suite name:(suite tests size printString,' tests') |
|
1021 |
]. |
|
1022 |
^suite |
|
1023 |
||
14739
ec549f688c75
Oops, fixes after refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14728
diff
changeset
|
1024 |
"Modified: / 23-09-2014 / 12:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
14728 | 1025 |
! ! |
1026 |
||
1027 |
!TestRunnerMini::SuiteAndResult class methodsFor:'instance creation'! |
|
1028 |
||
1029 |
suite: suite result: result |
|
1030 |
||
1031 |
^self new |
|
1032 |
suite: suite; |
|
1033 |
result: result. |
|
1034 |
||
1035 |
"Modified: / 15-03-2010 / 15:27:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1036 |
! ! |
|
1037 |
||
1038 |
!TestRunnerMini::SuiteAndResult methodsFor:'accessing'! |
|
1039 |
||
1040 |
color |
|
1041 |
|numTests numRun| |
|
1042 |
||
1043 |
self testCount > 0 ifTrue:[ |
|
1044 |
result notNil ifTrue:[ |
|
1045 |
self hasErrors ifTrue:[^AbstractTestRunner errorColor]. |
|
1046 |
self hasFailures ifTrue:[^AbstractTestRunner failedColor]. |
|
1047 |
self hasPassed ifTrue:[ |
|
1048 |
numTests := suite tests size. |
|
1049 |
numRun := result passedCount + result failureCount + result errorCount. |
|
1050 |
numRun = numTests ifTrue:[ |
|
1051 |
^AbstractTestRunner passedColor |
|
1052 |
] |
|
1053 |
]. |
|
1054 |
] |
|
1055 |
]. |
|
1056 |
^ AbstractTestRunner notRunColor |
|
1057 |
||
1058 |
"Created: / 15-03-2010 / 15:24:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1059 |
"Modified: / 23-09-2014 / 10:04:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1060 |
! |
|
1061 |
||
1062 |
info |
|
1063 |
|numTests numRun| |
|
1064 |
||
1065 |
result ifNil:[^'']. |
|
1066 |
||
1067 |
numTests := suite tests size. |
|
1068 |
numRun := result passedCount + result failureCount + result errorCount. |
|
1069 |
"/ (result passedCount + result failureCount + result errorCount) = 1 ifTrue:[^'']. |
|
1070 |
numRun == 0 ifTrue:[ |
|
1071 |
numTests == 1 ifTrue:[ |
|
1072 |
^'not run' |
|
1073 |
]. |
|
1074 |
^'%1 tests, 0 run' bindWith: numTests |
|
1075 |
]. |
|
1076 |
numRun < numTests ifTrue:[ |
|
1077 |
^'%1 tests, %2 run, %3 passed, %4 fail or error' |
|
1078 |
bindWith: numTests |
|
1079 |
with: numRun |
|
1080 |
with: result passedCount |
|
1081 |
with: (result failureCount+result errorCount) |
|
1082 |
]. |
|
1083 |
||
1084 |
^'%1 tests, %2 passed, %3 failed, %4 errors' |
|
1085 |
bindWith: numTests |
|
1086 |
with: result passedCount |
|
1087 |
with: result failureCount |
|
1088 |
with: result errorCount |
|
1089 |
||
1090 |
"Created: / 15-03-2010 / 20:23:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1091 |
! |
|
1092 |
||
1093 |
name |
|
1094 |
||
1095 |
^suite name |
|
1096 |
||
1097 |
"Created: / 15-03-2010 / 15:12:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1098 |
! |
|
1099 |
||
1100 |
result |
|
1101 |
^ result |
|
1102 |
! |
|
1103 |
||
1104 |
result:aTestResult |
|
1105 |
result := aTestResult. |
|
1106 |
! |
|
1107 |
||
1108 |
suite |
|
1109 |
^ suite |
|
1110 |
! |
|
1111 |
||
1112 |
suite:aTestSuite |
|
1113 |
suite := aTestSuite. |
|
1114 |
! |
|
1115 |
||
1116 |
suiteForRun |
|
1117 |
||
1118 |
| suiteForRun | |
|
1119 |
suiteForRun := suite class named: suite name. |
|
1120 |
suiteForRun addTests: |
|
1121 |
(suite tests collect:[:testCase|testCase class selector: testCase selector]). |
|
1122 |
^suiteForRun |
|
1123 |
||
1124 |
"Created: / 22-08-2011 / 09:56:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1125 |
! |
|
1126 |
||
1127 |
testCount |
|
1128 |
||
1129 |
^suite tests size |
|
1130 |
||
1131 |
"Created: / 15-03-2010 / 15:44:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1132 |
! ! |
|
1133 |
||
1134 |
!TestRunnerMini::SuiteAndResult methodsFor:'queries'! |
|
1135 |
||
1136 |
hasErrors |
|
1137 |
||
1138 |
^result errorCount > 0 |
|
1139 |
||
1140 |
"Created: / 15-03-2010 / 15:21:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1141 |
! |
|
1142 |
||
1143 |
hasFailures |
|
1144 |
||
1145 |
^result failureCount > 0 |
|
1146 |
||
1147 |
"Created: / 15-03-2010 / 15:21:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1148 |
! |
|
1149 |
||
1150 |
hasFailuresOrErrors |
|
1151 |
||
1152 |
^self hasErrors or:[self hasFailures] |
|
1153 |
||
1154 |
"Created: / 15-03-2010 / 15:45:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1155 |
! |
|
1156 |
||
1157 |
hasPassed |
|
1158 |
||
1159 |
^result passedCount > 0 |
|
1160 |
||
1161 |
"Created: / 15-03-2010 / 22:06:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1162 |
! ! |
|
1163 |
||
1164 |
!TestRunnerMini class methodsFor:'documentation'! |
|
1165 |
||
1166 |
version |
|
14831
17e27adfbd3d
Changed title of Tools::TestRunnerMini
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14739
diff
changeset
|
1167 |
^ '$Header: /cvs/stx/stx/libtool/Tools__TestRunnerMini.st,v 1.3 2014-11-14 07:46:42 vrany Exp $' |
14728 | 1168 |
! |
1169 |
||
1170 |
version_CVS |
|
14831
17e27adfbd3d
Changed title of Tools::TestRunnerMini
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14739
diff
changeset
|
1171 |
^ '$Header: /cvs/stx/stx/libtool/Tools__TestRunnerMini.st,v 1.3 2014-11-14 07:46:42 vrany Exp $' |
14728 | 1172 |
! |
1173 |
||
1174 |
version_SVN |
|
14831
17e27adfbd3d
Changed title of Tools::TestRunnerMini
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14739
diff
changeset
|
1175 |
^ '$Id: Tools__TestRunnerMini.st,v 1.3 2014-11-14 07:46:42 vrany Exp $' |
14728 | 1176 |
! ! |
1177 |