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