447
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
349
|
3 |
"{ Package: 'stx:goodies/builder/quickSelfTest' }"
|
329
|
4 |
|
|
5 |
"{ NameSpace: Smalltalk }"
|
|
6 |
|
|
7 |
Object subclass:#RunUnitTests
|
|
8 |
instanceVariableNames:''
|
|
9 |
classVariableNames:''
|
|
10 |
poolDictionaries:''
|
|
11 |
category:'tests-Regression'
|
|
12 |
!
|
|
13 |
|
|
14 |
!RunUnitTests class methodsFor:'documentation'!
|
|
15 |
|
|
16 |
documentation
|
|
17 |
"
|
|
18 |
documentation to be added.
|
|
19 |
|
|
20 |
[author:]
|
336
|
21 |
sr
|
329
|
22 |
|
|
23 |
[instance variables:]
|
|
24 |
|
|
25 |
[class variables:]
|
|
26 |
|
|
27 |
[see also:]
|
|
28 |
|
|
29 |
"
|
|
30 |
! !
|
|
31 |
|
|
32 |
!RunUnitTests class methodsFor:'actions'!
|
|
33 |
|
|
34 |
run
|
400
|
35 |
self runWithCompiledUnitTestClasses:false.
|
398
|
36 |
!
|
|
37 |
|
|
38 |
runWithCompiledUnitTestClasses:useCompiledUnitTestClasses
|
426
|
39 |
|cmdArgs|
|
|
40 |
|
|
41 |
cmdArgs := Smalltalk commandLineArguments.
|
|
42 |
|
|
43 |
self
|
|
44 |
runWithCompiledUnitTestClasses:useCompiledUnitTestClasses
|
|
45 |
arguments:cmdArgs
|
|
46 |
debug:(cmdArgs includes:'--debug')
|
|
47 |
!
|
|
48 |
|
|
49 |
runWithCompiledUnitTestClasses:useCompiledUnitTestClasses
|
|
50 |
arguments:arguments
|
|
51 |
debug:debug
|
|
52 |
|
398
|
53 |
|doRunSpecificUnitTests unitTestSuiteName excludedUnitTestClassNames corruptedUnitTestClassNames
|
|
54 |
unitTestSuite
|
427
|
55 |
eachClass
|
419
|
56 |
result index
|
418
|
57 |
settingsFilePathName resultFilePathName forceTestCase|
|
398
|
58 |
|
|
59 |
doRunSpecificUnitTests := false.
|
|
60 |
unitTestSuiteName := 'All Unit Tests'.
|
|
61 |
excludedUnitTestClassNames := self excludedUnitTestClassNamesForAll.
|
|
62 |
corruptedUnitTestClassNames := self corruptedUnitTestClassNames.
|
|
63 |
|
447
|
64 |
index := arguments indexOf:'--settingsFile'.
|
398
|
65 |
index > 0 ifTrue:[
|
447
|
66 |
settingsFilePathName := arguments at:index + 1.
|
426
|
67 |
self logInfo:'load settings file: ', settingsFilePathName printString.
|
|
68 |
settingsFilePathName asFilename fileIn.
|
|
69 |
self logInfo:'ParserFlags makeCommand: ', ParserFlags makeCommand printString.
|
418
|
70 |
].
|
|
71 |
|
447
|
72 |
(arguments includes:'--runOnlyExpeccoUnitTests') ifTrue:[
|
426
|
73 |
self logInfo:'configured to run expecco unit tests only'.
|
|
74 |
doRunSpecificUnitTests := true.
|
|
75 |
unitTestSuiteName := 'expecco Unit Tests'.
|
|
76 |
excludedUnitTestClassNames := self excludedUnitTestClassNamesForExpecco.
|
398
|
77 |
].
|
|
78 |
|
447
|
79 |
index := arguments indexOf:'--resultFile'.
|
413
|
80 |
index > 0 ifTrue:[
|
447
|
81 |
resultFilePathName := arguments at:index + 1.
|
426
|
82 |
self logInfo:'set custom result file: ', resultFilePathName printString.
|
413
|
83 |
].
|
|
84 |
|
447
|
85 |
index := arguments indexOf:'--forceTestCase'.
|
418
|
86 |
index > 0 ifTrue:[
|
447
|
87 |
forceTestCase := arguments at:index + 1.
|
426
|
88 |
self logInfo:'set force test case: ', forceTestCase printString.
|
419
|
89 |
].
|
398
|
90 |
|
|
91 |
doRunSpecificUnitTests ifFalse:[
|
426
|
92 |
self logInfo:'configured to run all available unit tests'.
|
398
|
93 |
].
|
|
94 |
|
|
95 |
self logInfo:'collecting unit test classes to run'.
|
|
96 |
unitTestSuite := TestSuite named:unitTestSuiteName.
|
|
97 |
|
427
|
98 |
(Smalltalk at: #'stx_goodies_regression') classNames do:[:eachClassName |
|
426
|
99 |
(excludedUnitTestClassNames includes:eachClassName) ifTrue:[
|
|
100 |
self
|
|
101 |
logInfo:('excluded unit test class "%1".'
|
|
102 |
bindWith:eachClassName).
|
|
103 |
] ifFalse:[
|
|
104 |
(corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
|
|
105 |
self
|
|
106 |
logWarning:('corrupted unit test class detected, please fix #%1'
|
|
107 |
bindWith:eachClassName).
|
|
108 |
] ifFalse:[
|
|
109 |
(eachClassName notNil
|
|
110 |
and:[
|
|
111 |
"/ skip non test case classes
|
|
112 |
(#(
|
|
113 |
'stx_goodies_regression'
|
|
114 |
) includes:eachClassName) not
|
|
115 |
and:[
|
|
116 |
forceTestCase isNil
|
|
117 |
or:[forceTestCase = eachClassName
|
|
118 |
or:[forceTestCase = ((eachClassName subStrings:'::') lastIfEmpty:nil)]]
|
|
119 |
]]) ifTrue:[
|
|
120 |
eachClass := Smalltalk at:eachClassName.
|
407
|
121 |
|
426
|
122 |
useCompiledUnitTestClasses ifFalse:[
|
|
123 |
"here we want test the jitter code
|
|
124 |
therfor we file in, exit if the class is already present somwhow"
|
|
125 |
eachClass notNil ifTrue:[
|
|
126 |
self
|
|
127 |
logWarning:('Unit test class "%1" was already present before file in.'
|
|
128 |
bindWith:eachClassName).
|
407
|
129 |
|
426
|
130 |
Smalltalk exit:1.
|
|
131 |
].
|
407
|
132 |
|
426
|
133 |
eachClass := Smalltalk
|
|
134 |
fileInClass:eachClassName
|
|
135 |
package:'stx:goodies/regression'.
|
|
136 |
].
|
398
|
137 |
|
426
|
138 |
eachClass notNil ifTrue:[
|
427
|
139 |
(eachClass isTestCaseLike
|
|
140 |
and:[eachClass isAbstract not]) ifTrue:[
|
426
|
141 |
self
|
|
142 |
logInfo:('added unit test class "%1".'
|
|
143 |
bindWith:eachClassName).
|
422
|
144 |
|
426
|
145 |
unitTestSuite addTest:eachClass suite.
|
427
|
146 |
] ifFalse:[
|
|
147 |
self
|
|
148 |
logInfo:('not a unit test class "%1" (class is abstract or something else).'
|
|
149 |
bindWith:eachClassName).
|
426
|
150 |
].
|
|
151 |
] ifFalse:[
|
|
152 |
self
|
|
153 |
logWarning:('unit test class "%1" is not loaded.'
|
|
154 |
bindWith:eachClassName).
|
|
155 |
].
|
|
156 |
] ifFalse:[
|
|
157 |
self
|
|
158 |
logInfo:('skipped unit test class "%1".'
|
|
159 |
bindWith:eachClassName).
|
|
160 |
].
|
|
161 |
].
|
|
162 |
].
|
398
|
163 |
].
|
|
164 |
|
|
165 |
self
|
426
|
166 |
logInfo:('%1 unit test classes collected'
|
|
167 |
bindWith:unitTestSuite tests size).
|
398
|
168 |
|
|
169 |
self logInfo:'starting unit tests'.
|
|
170 |
result := unitTestSuite
|
426
|
171 |
run:TestResultStX new
|
|
172 |
beforeEachDo:[:test | self logInfo:'performing unit test ', test printString]
|
|
173 |
afterEachDo:[:test| ]
|
|
174 |
debug:debug.
|
398
|
175 |
|
|
176 |
self logInfo:'generating report'.
|
|
177 |
TestResultReporter
|
426
|
178 |
report:result
|
|
179 |
format:#xml_jUnit
|
|
180 |
as:resultFilePathName ? 'testresult.xml'.
|
398
|
181 |
|
|
182 |
self logInfo:'summary:'.
|
|
183 |
self logInfo:('%1 tests' bindWith:result runCount).
|
|
184 |
self logInfo:('%1 passed' bindWith:result passedCount).
|
|
185 |
self logInfo:('%1 failed' bindWith:result failureCount).
|
|
186 |
self logInfo:('%1 errors' bindWith:result errorCount).
|
329
|
187 |
! !
|
|
188 |
|
|
189 |
!RunUnitTests class methodsFor:'constants'!
|
|
190 |
|
|
191 |
corruptedUnitTestClassNames
|
|
192 |
^ #(
|
336
|
193 |
#'RegressionTests::ExternalInterfaceTests'
|
|
194 |
#'RegressionTests::HTTPServerTests'
|
|
195 |
#'RegressionTests::DebuggerTest'
|
345
|
196 |
#'RegressionTests::ContextTest2'
|
329
|
197 |
)
|
|
198 |
!
|
|
199 |
|
|
200 |
excludedUnitTestClassNamesForAll
|
419
|
201 |
^ #(
|
|
202 |
#'RegressionTests::SelectorNamespacesTests'
|
|
203 |
)
|
329
|
204 |
!
|
|
205 |
|
336
|
206 |
excludedUnitTestClassNamesForExpecco
|
329
|
207 |
^ self excludedUnitTestClassNamesForAll
|
410
|
208 |
, #(
|
424
|
209 |
#'RegressionTests::VMCrashTestCase'
|
419
|
210 |
#'RegressionTests::VMCrashTests'
|
420
|
211 |
#'RegressionTests::ParserTests'
|
410
|
212 |
#'RegressionTests::BreakpointTests'
|
|
213 |
#'RegressionTests::SunitXMLOutputTest'
|
|
214 |
#'RegressionTests::CompilerTests2'
|
|
215 |
#'RegressionTests::BehaviorLookupObjectTests'
|
|
216 |
#'RegressionTests::ChangeSetTests'
|
|
217 |
#'RegressionTests::MakefileTests'
|
|
218 |
#'RegressionTests::MetaphoneStringComparatorTest'
|
|
219 |
#'RegressionTests::STCCompilerTests'
|
|
220 |
#'RegressionTests::VMCrashTests'
|
|
221 |
#'RegressionTests::SnapshotRestartTests'
|
|
222 |
#'RegressionTests::GraphicDrawingTest'
|
|
223 |
#'RegressionTests::OS_OLE_Tests'
|
|
224 |
#'RegressionTests::ExternalInterfaceTests'
|
|
225 |
#'RegressionTests::HTTPServerTests'
|
|
226 |
#'RegressionTests::DebuggerTest'
|
|
227 |
#'RegressionTests::ContextTest2'
|
415
|
228 |
#'RegressionTests::QDoubleTests'
|
410
|
229 |
)
|
329
|
230 |
! !
|
|
231 |
|
428
|
232 |
!RunUnitTests class methodsFor:'examples'!
|
|
233 |
|
|
234 |
example1
|
|
235 |
Processor activeProcess exceptionHandlerSet
|
|
236 |
on:Class updateChangeFileQuerySignal
|
|
237 |
do:[:ex | ex proceedWith:false].
|
|
238 |
|
|
239 |
self
|
|
240 |
runWithCompiledUnitTestClasses:true
|
|
241 |
arguments:#(
|
|
242 |
'--runOnlyExpeccoUnitTests'
|
444
|
243 |
'--forceTestCase'
|
446
|
244 |
'ExternalStreamTest'
|
428
|
245 |
)
|
|
246 |
debug:true
|
|
247 |
! !
|
|
248 |
|
329
|
249 |
!RunUnitTests class methodsFor:'logging'!
|
|
250 |
|
|
251 |
log:aString
|
|
252 |
type:aType
|
|
253 |
|
336
|
254 |
Stdout
|
|
255 |
showCR:('%1 [%2] : %3'
|
|
256 |
bindWith:Timestamp now printString
|
|
257 |
with:(aType printString asLowercase paddedTo:'warning' size)
|
|
258 |
with:aString).
|
329
|
259 |
!
|
|
260 |
|
|
261 |
logInfo:aString
|
|
262 |
self
|
336
|
263 |
log:aString
|
|
264 |
type:'INFO'
|
329
|
265 |
!
|
|
266 |
|
|
267 |
logWarning:aString
|
|
268 |
self
|
336
|
269 |
log:aString
|
|
270 |
type:'WARNING'
|
329
|
271 |
! !
|
349
|
272 |
|
|
273 |
!RunUnitTests class methodsFor:'documentation'!
|
|
274 |
|
399
|
275 |
version
|
|
276 |
^ '$Header$'
|
|
277 |
!
|
|
278 |
|
349
|
279 |
version_CVS
|
|
280 |
^ '$Header$'
|
|
281 |
! !
|
426
|
282 |
|