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
|
|
43 |
result index settingsFilePathName|
|
|
44 |
|
|
45 |
doRunSpecificUnitTests := false.
|
|
46 |
unitTestSuiteName := 'All Unit Tests'.
|
|
47 |
excludedUnitTestClassNames := self excludedUnitTestClassNamesForAll.
|
|
48 |
corruptedUnitTestClassNames := self corruptedUnitTestClassNames.
|
|
49 |
|
|
50 |
cmdArgs := Smalltalk commandLineArguments.
|
|
51 |
index := cmdArgs indexOf:'--settingsFile'.
|
|
52 |
index > 0 ifTrue:[
|
|
53 |
settingsFilePathName := cmdArgs at:index + 1.
|
|
54 |
self logInfo:'load settings file: ', settingsFilePathName printString.
|
|
55 |
settingsFilePathName asFilename fileIn.
|
|
56 |
self logInfo:'ParserFlags makeCommand: ', ParserFlags makeCommand printString.
|
|
57 |
].
|
|
58 |
|
|
59 |
(cmdArgs includes:'--runOnlyExpeccoUnitTests') ifTrue:[
|
|
60 |
self logInfo:'configured to run expecco unit tests only'.
|
|
61 |
doRunSpecificUnitTests := true.
|
|
62 |
unitTestSuiteName := 'expecco Unit Tests'.
|
|
63 |
excludedUnitTestClassNames := self excludedUnitTestClassNamesForExpecco.
|
|
64 |
].
|
|
65 |
|
|
66 |
doRunSpecificUnitTests ifFalse:[
|
|
67 |
self logInfo:'configured to run all available unit tests'.
|
|
68 |
].
|
|
69 |
|
|
70 |
self logInfo:'collecting unit test classes to run'.
|
|
71 |
unitTestSuite := TestSuite named:unitTestSuiteName.
|
|
72 |
|
399
|
73 |
self logInfo:'1 ', (Smalltalk at: #'stx_goodies_regression') printString.
|
|
74 |
self logInfo:'2 ', (Smalltalk at: #'stx_goodies_regression') classNamesAndAttributes printString.
|
398
|
75 |
|
|
76 |
(Smalltalk at: #'stx_goodies_regression') classNamesAndAttributes do:[:eachClassNameAndAttributes |
|
|
77 |
eachClassNameAndAttributes isSymbol ifTrue:[
|
|
78 |
eachClassName := eachClassNameAndAttributes.
|
|
79 |
] ifFalse:[
|
|
80 |
eachClassName := eachClassNameAndAttributes
|
|
81 |
firstIfEmpty:nil.
|
|
82 |
].
|
|
83 |
|
|
84 |
(excludedUnitTestClassNames includes:eachClassName) ifFalse:[
|
|
85 |
(corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
|
|
86 |
self
|
|
87 |
logWarning:('corrupted unit test class detected, please fix #%1'
|
|
88 |
bindWith:eachClassName).
|
|
89 |
] ifFalse:[
|
|
90 |
eachClassName notNil ifTrue:[
|
402
|
91 |
"/ check if loaded
|
398
|
92 |
eachClass := Smalltalk
|
|
93 |
fileInClass:eachClassName
|
|
94 |
package:'stx:goodies/regression'.
|
|
95 |
|
|
96 |
eachClass notNil ifTrue:[
|
|
97 |
eachClass isTestCaseLike ifTrue:[
|
|
98 |
unitTestSuite addTest:eachClass suite.
|
|
99 |
].
|
|
100 |
].
|
|
101 |
].
|
|
102 |
].
|
|
103 |
].
|
|
104 |
].
|
|
105 |
|
|
106 |
self
|
|
107 |
logInfo:('%1 unit test classes collected'
|
|
108 |
bindWith:unitTestSuite tests size).
|
|
109 |
|
|
110 |
self logInfo:'starting unit tests'.
|
|
111 |
result := unitTestSuite
|
|
112 |
run:TestResultStX new
|
|
113 |
beforeEachDo:[:test | self logInfo:'performing unit test ', test printString]
|
|
114 |
afterEachDo:[:test| ]
|
|
115 |
debug:(cmdArgs includes:'--debug').
|
|
116 |
|
|
117 |
self logInfo:'generating report'.
|
|
118 |
TestResultReporter
|
|
119 |
report:result
|
|
120 |
format:#xml_jUnit
|
|
121 |
as:'testresult.xml'.
|
|
122 |
|
|
123 |
self logInfo:'summary:'.
|
|
124 |
self logInfo:('%1 tests' bindWith:result runCount).
|
|
125 |
self logInfo:('%1 passed' bindWith:result passedCount).
|
|
126 |
self logInfo:('%1 failed' bindWith:result failureCount).
|
|
127 |
self logInfo:('%1 errors' bindWith:result errorCount).
|
329
|
128 |
! !
|
|
129 |
|
|
130 |
!RunUnitTests class methodsFor:'constants'!
|
|
131 |
|
|
132 |
corruptedUnitTestClassNames
|
|
133 |
^ #(
|
336
|
134 |
#'RegressionTests::ExternalInterfaceTests'
|
|
135 |
#'RegressionTests::HTTPServerTests'
|
|
136 |
#'RegressionTests::DebuggerTest'
|
345
|
137 |
#'RegressionTests::ContextTest2'
|
329
|
138 |
)
|
|
139 |
!
|
|
140 |
|
|
141 |
excludedUnitTestClassNamesForAll
|
|
142 |
^ #()
|
|
143 |
!
|
|
144 |
|
336
|
145 |
excludedUnitTestClassNamesForExpecco
|
329
|
146 |
^ self excludedUnitTestClassNamesForAll
|
402
|
147 |
, #(
|
|
148 |
#'RegressionTests::BreakpointTests'
|
|
149 |
#'RegressionTests::SunitXMLOutputTest'
|
|
150 |
#'RegressionTests::CompilerTests2'
|
|
151 |
#'RegressionTests::BehaviorLookupObjectTests'
|
|
152 |
#'RegressionTests::ChangeSetTests'
|
|
153 |
#'RegressionTests::MakefileTests'
|
|
154 |
#'RegressionTests::MetaphoneStringComparatorTest'
|
|
155 |
#'RegressionTests::STCCompilerTests'
|
|
156 |
#'RegressionTests::VMCrashTests'
|
|
157 |
#'RegressionTests::SnapshotRestartTests'
|
|
158 |
#'RegressionTests::GraphicDrawingTest'
|
|
159 |
#'RegressionTests::OS_OLE_Tests'
|
|
160 |
#'RegressionTests::ExternalInterfaceTests'
|
|
161 |
#'RegressionTests::HTTPServerTests'
|
|
162 |
#'RegressionTests::DebuggerTest'
|
|
163 |
#'RegressionTests::ContextTest2'
|
|
164 |
)
|
329
|
165 |
! !
|
|
166 |
|
|
167 |
!RunUnitTests class methodsFor:'logging'!
|
|
168 |
|
|
169 |
log:aString
|
|
170 |
type:aType
|
|
171 |
|
336
|
172 |
Stdout
|
|
173 |
showCR:('%1 [%2] : %3'
|
|
174 |
bindWith:Timestamp now printString
|
|
175 |
with:(aType printString asLowercase paddedTo:'warning' size)
|
|
176 |
with:aString).
|
329
|
177 |
!
|
|
178 |
|
|
179 |
logInfo:aString
|
|
180 |
self
|
336
|
181 |
log:aString
|
|
182 |
type:'INFO'
|
329
|
183 |
!
|
|
184 |
|
|
185 |
logWarning:aString
|
|
186 |
self
|
336
|
187 |
log:aString
|
|
188 |
type:'WARNING'
|
329
|
189 |
! !
|
349
|
190 |
|
|
191 |
!RunUnitTests class methodsFor:'documentation'!
|
|
192 |
|
399
|
193 |
version
|
|
194 |
^ '$Header$'
|
|
195 |
!
|
|
196 |
|
349
|
197 |
version_CVS
|
|
198 |
^ '$Header$'
|
|
199 |
! !
|
|
200 |
|