349
|
1 |
"{ Encoding: utf8 }"
|
329
|
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
|
|
35 |
|doRunSpecificUnitTests unitTestSuiteName excludedUnitTestClassNames corruptedUnitTestClassNames
|
336
|
36 |
cmdArgs
|
|
37 |
unitTestSuite
|
329
|
38 |
eachClassName eachClass
|
348
|
39 |
result index settingsFilePathName|
|
329
|
40 |
|
|
41 |
doRunSpecificUnitTests := false.
|
336
|
42 |
unitTestSuiteName := 'All Unit Tests'.
|
329
|
43 |
excludedUnitTestClassNames := self excludedUnitTestClassNamesForAll.
|
|
44 |
corruptedUnitTestClassNames := self corruptedUnitTestClassNames.
|
|
45 |
|
|
46 |
cmdArgs := Smalltalk commandLineArguments.
|
346
|
47 |
index := cmdArgs indexOf:'--settingsFile'.
|
|
48 |
index > 0 ifTrue:[
|
348
|
49 |
settingsFilePathName := cmdArgs at:index + 1.
|
|
50 |
self logInfo:'load settings file: ', settingsFilePathName printString.
|
|
51 |
settingsFilePathName asFilename fileIn.
|
|
52 |
self logInfo:'ParserFlags makeCommand: ', ParserFlags makeCommand printString.
|
346
|
53 |
].
|
|
54 |
|
329
|
55 |
(cmdArgs includes:'--runOnlyExpeccoUnitTests') ifTrue:[
|
336
|
56 |
self logInfo:'configured to run expecco unit tests only'.
|
|
57 |
doRunSpecificUnitTests := true.
|
|
58 |
unitTestSuiteName := 'expecco Unit Tests'.
|
|
59 |
excludedUnitTestClassNames := self excludedUnitTestClassNamesForExpecco.
|
329
|
60 |
].
|
|
61 |
|
|
62 |
doRunSpecificUnitTests ifFalse:[
|
336
|
63 |
self logInfo:'configured to run all available unit tests'.
|
329
|
64 |
].
|
|
65 |
|
|
66 |
self logInfo:'collecting unit test classes to run'.
|
|
67 |
unitTestSuite := TestSuite named:unitTestSuiteName.
|
|
68 |
(Smalltalk at: #'stx_goodies_regression') classNamesAndAttributes do:[:eachClassNameAndAttributes |
|
336
|
69 |
eachClassNameAndAttributes isSymbol ifTrue:[
|
|
70 |
eachClassName := eachClassNameAndAttributes.
|
|
71 |
] ifFalse:[
|
|
72 |
eachClassName := eachClassNameAndAttributes
|
|
73 |
firstIfEmpty:nil.
|
|
74 |
].
|
329
|
75 |
|
345
|
76 |
(excludedUnitTestClassNames includes:eachClassName) ifFalse:[
|
|
77 |
(corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
|
346
|
78 |
self
|
345
|
79 |
logWarning:('corrupted unit test class detected, please fix #%1'
|
346
|
80 |
bindWith:eachClassName).
|
345
|
81 |
] ifFalse:[
|
348
|
82 |
eachClassName notNil ifTrue:[
|
345
|
83 |
eachClass := Smalltalk
|
|
84 |
fileInClass:eachClassName
|
|
85 |
package:'stx:goodies/regression'.
|
329
|
86 |
|
345
|
87 |
eachClass notNil ifTrue:[
|
|
88 |
eachClass isTestCaseLike ifTrue:[
|
|
89 |
unitTestSuite addTest:eachClass suite.
|
|
90 |
].
|
336
|
91 |
].
|
|
92 |
].
|
|
93 |
].
|
|
94 |
].
|
329
|
95 |
].
|
|
96 |
|
336
|
97 |
self
|
|
98 |
logInfo:('%1 unit test classes collected'
|
|
99 |
bindWith:unitTestSuite tests size).
|
329
|
100 |
|
|
101 |
self logInfo:'starting unit tests'.
|
|
102 |
result := unitTestSuite
|
336
|
103 |
run:TestResultStX new
|
|
104 |
beforeEachDo:[:test | self logInfo:'performing unit test ', test printString]
|
|
105 |
afterEachDo:[:test| ]
|
|
106 |
debug:(cmdArgs includes:'--debug').
|
329
|
107 |
|
|
108 |
self logInfo:'generating report'.
|
|
109 |
TestResultReporter
|
336
|
110 |
report:result
|
|
111 |
format:#xml_jUnit
|
|
112 |
as:'testresult.xml'.
|
329
|
113 |
|
|
114 |
self logInfo:'summary:'.
|
|
115 |
self logInfo:('%1 tests' bindWith:result runCount).
|
|
116 |
self logInfo:('%1 passed' bindWith:result passedCount).
|
|
117 |
self logInfo:('%1 failed' bindWith:result failureCount).
|
|
118 |
self logInfo:('%1 errors' bindWith:result errorCount).
|
398
|
119 |
!
|
|
120 |
|
|
121 |
runWithCompiledUnitTestClasses:useCompiledUnitTestClasses
|
|
122 |
|doRunSpecificUnitTests unitTestSuiteName excludedUnitTestClassNames corruptedUnitTestClassNames
|
|
123 |
cmdArgs
|
|
124 |
unitTestSuite
|
|
125 |
eachClassName eachClass
|
|
126 |
result index settingsFilePathName|
|
|
127 |
|
|
128 |
doRunSpecificUnitTests := false.
|
|
129 |
unitTestSuiteName := 'All Unit Tests'.
|
|
130 |
excludedUnitTestClassNames := self excludedUnitTestClassNamesForAll.
|
|
131 |
corruptedUnitTestClassNames := self corruptedUnitTestClassNames.
|
|
132 |
|
|
133 |
cmdArgs := Smalltalk commandLineArguments.
|
|
134 |
index := cmdArgs indexOf:'--settingsFile'.
|
|
135 |
index > 0 ifTrue:[
|
|
136 |
settingsFilePathName := cmdArgs at:index + 1.
|
|
137 |
self logInfo:'load settings file: ', settingsFilePathName printString.
|
|
138 |
settingsFilePathName asFilename fileIn.
|
|
139 |
self logInfo:'ParserFlags makeCommand: ', ParserFlags makeCommand printString.
|
|
140 |
].
|
|
141 |
|
|
142 |
(cmdArgs includes:'--runOnlyExpeccoUnitTests') ifTrue:[
|
|
143 |
self logInfo:'configured to run expecco unit tests only'.
|
|
144 |
doRunSpecificUnitTests := true.
|
|
145 |
unitTestSuiteName := 'expecco Unit Tests'.
|
|
146 |
excludedUnitTestClassNames := self excludedUnitTestClassNamesForExpecco.
|
|
147 |
].
|
|
148 |
|
|
149 |
doRunSpecificUnitTests ifFalse:[
|
|
150 |
self logInfo:'configured to run all available unit tests'.
|
|
151 |
].
|
|
152 |
|
|
153 |
self logInfo:'collecting unit test classes to run'.
|
|
154 |
unitTestSuite := TestSuite named:unitTestSuiteName.
|
|
155 |
|
|
156 |
Transcript showCR:'1 ', (Smalltalk at: #'stx_goodies_regression') printString.
|
|
157 |
Transcript showCR:'2 ', (Smalltalk at: #'stx_goodies_regression') classNamesAndAttributes printString.
|
|
158 |
|
|
159 |
(Smalltalk at: #'stx_goodies_regression') classNamesAndAttributes do:[:eachClassNameAndAttributes |
|
|
160 |
eachClassNameAndAttributes isSymbol ifTrue:[
|
|
161 |
eachClassName := eachClassNameAndAttributes.
|
|
162 |
] ifFalse:[
|
|
163 |
eachClassName := eachClassNameAndAttributes
|
|
164 |
firstIfEmpty:nil.
|
|
165 |
].
|
|
166 |
|
|
167 |
(excludedUnitTestClassNames includes:eachClassName) ifFalse:[
|
|
168 |
(corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
|
|
169 |
self
|
|
170 |
logWarning:('corrupted unit test class detected, please fix #%1'
|
|
171 |
bindWith:eachClassName).
|
|
172 |
] ifFalse:[
|
|
173 |
eachClassName notNil ifTrue:[
|
|
174 |
eachClass := Smalltalk
|
|
175 |
fileInClass:eachClassName
|
|
176 |
package:'stx:goodies/regression'.
|
|
177 |
|
|
178 |
eachClass notNil ifTrue:[
|
|
179 |
eachClass isTestCaseLike ifTrue:[
|
|
180 |
unitTestSuite addTest:eachClass suite.
|
|
181 |
].
|
|
182 |
].
|
|
183 |
].
|
|
184 |
].
|
|
185 |
].
|
|
186 |
].
|
|
187 |
|
|
188 |
self
|
|
189 |
logInfo:('%1 unit test classes collected'
|
|
190 |
bindWith:unitTestSuite tests size).
|
|
191 |
|
|
192 |
self logInfo:'starting unit tests'.
|
|
193 |
result := unitTestSuite
|
|
194 |
run:TestResultStX new
|
|
195 |
beforeEachDo:[:test | self logInfo:'performing unit test ', test printString]
|
|
196 |
afterEachDo:[:test| ]
|
|
197 |
debug:(cmdArgs includes:'--debug').
|
|
198 |
|
|
199 |
self logInfo:'generating report'.
|
|
200 |
TestResultReporter
|
|
201 |
report:result
|
|
202 |
format:#xml_jUnit
|
|
203 |
as:'testresult.xml'.
|
|
204 |
|
|
205 |
self logInfo:'summary:'.
|
|
206 |
self logInfo:('%1 tests' bindWith:result runCount).
|
|
207 |
self logInfo:('%1 passed' bindWith:result passedCount).
|
|
208 |
self logInfo:('%1 failed' bindWith:result failureCount).
|
|
209 |
self logInfo:('%1 errors' bindWith:result errorCount).
|
329
|
210 |
! !
|
|
211 |
|
|
212 |
!RunUnitTests class methodsFor:'constants'!
|
|
213 |
|
|
214 |
corruptedUnitTestClassNames
|
|
215 |
^ #(
|
336
|
216 |
#'RegressionTests::ExternalInterfaceTests'
|
|
217 |
#'RegressionTests::HTTPServerTests'
|
|
218 |
#'RegressionTests::DebuggerTest'
|
345
|
219 |
#'RegressionTests::ContextTest2'
|
329
|
220 |
)
|
|
221 |
!
|
|
222 |
|
|
223 |
excludedUnitTestClassNamesForAll
|
|
224 |
^ #()
|
|
225 |
!
|
|
226 |
|
336
|
227 |
excludedUnitTestClassNamesForExpecco
|
329
|
228 |
^ self excludedUnitTestClassNamesForAll
|
336
|
229 |
, #(
|
|
230 |
#'RegressionTests::BreakpointTests'
|
|
231 |
#'RegressionTests::SunitXMLOutputTest'
|
338
|
232 |
#'RegressionTests::CompilerTests2'
|
|
233 |
#'RegressionTests::BehaviorLookupObjectTests'
|
|
234 |
#'RegressionTests::ChangeSetTests'
|
|
235 |
#'RegressionTests::MakefileTests'
|
|
236 |
#'RegressionTests::MetaphoneStringComparatorTest'
|
|
237 |
#'RegressionTests::STCCompilerTests'
|
|
238 |
#'RegressionTests::VMCrashTests'
|
339
|
239 |
#'RegressionTests::SnapshotRestartTests'
|
340
|
240 |
#'RegressionTests::GraphicDrawingTest'
|
341
|
241 |
#'RegressionTests::OS_OLE_Tests'
|
345
|
242 |
#'RegressionTests::ExternalInterfaceTests'
|
|
243 |
#'RegressionTests::HTTPServerTests'
|
|
244 |
#'RegressionTests::DebuggerTest'
|
|
245 |
#'RegressionTests::ContextTest2'
|
336
|
246 |
)
|
329
|
247 |
! !
|
|
248 |
|
|
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 |
|
|
275 |
version_CVS
|
|
276 |
^ '$Header$'
|
|
277 |
! !
|
|
278 |
|