335
|
1 |
'From Smalltalk/X, Version:7.1.0.0 on 12-09-2017 at 13:33:27' !
|
329
|
2 |
|
|
3 |
"{ Package: 'stx:goodies/regression' }"
|
|
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
|
|
39 |
result|
|
|
40 |
|
|
41 |
doRunSpecificUnitTests := false.
|
336
|
42 |
unitTestSuiteName := 'All Unit Tests'.
|
329
|
43 |
excludedUnitTestClassNames := self excludedUnitTestClassNamesForAll.
|
|
44 |
corruptedUnitTestClassNames := self corruptedUnitTestClassNames.
|
|
45 |
|
|
46 |
cmdArgs := Smalltalk commandLineArguments.
|
|
47 |
(cmdArgs includes:'--runOnlyExpeccoUnitTests') ifTrue:[
|
336
|
48 |
self logInfo:'configured to run expecco unit tests only'.
|
|
49 |
doRunSpecificUnitTests := true.
|
|
50 |
unitTestSuiteName := 'expecco Unit Tests'.
|
|
51 |
excludedUnitTestClassNames := self excludedUnitTestClassNamesForExpecco.
|
329
|
52 |
].
|
|
53 |
|
|
54 |
doRunSpecificUnitTests ifFalse:[
|
336
|
55 |
self logInfo:'configured to run all available unit tests'.
|
329
|
56 |
].
|
|
57 |
|
|
58 |
self logInfo:'collecting unit test classes to run'.
|
|
59 |
unitTestSuite := TestSuite named:unitTestSuiteName.
|
|
60 |
(Smalltalk at: #'stx_goodies_regression') classNamesAndAttributes do:[:eachClassNameAndAttributes |
|
336
|
61 |
eachClassNameAndAttributes isSymbol ifTrue:[
|
|
62 |
eachClassName := eachClassNameAndAttributes.
|
|
63 |
] ifFalse:[
|
|
64 |
eachClassName := eachClassNameAndAttributes
|
|
65 |
firstIfEmpty:nil.
|
|
66 |
].
|
329
|
67 |
|
336
|
68 |
(corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
|
|
69 |
self
|
|
70 |
logWarning:('corrupted unit test class detected, please fix #%1'
|
|
71 |
bindWith:eachClassName).
|
|
72 |
] ifFalse:[
|
|
73 |
(excludedUnitTestClassNames includes:eachClassName) ifFalse:[
|
|
74 |
eachClassName notNil ifTrue:[
|
|
75 |
eachClass := Smalltalk
|
|
76 |
fileInClass:eachClassName
|
|
77 |
package:'stx:goodies/regression'.
|
329
|
78 |
|
336
|
79 |
eachClass notNil ifTrue:[
|
|
80 |
eachClass isTestCaseLike ifTrue:[
|
|
81 |
unitTestSuite addTest:eachClass suite.
|
|
82 |
].
|
|
83 |
].
|
|
84 |
].
|
|
85 |
].
|
|
86 |
].
|
329
|
87 |
].
|
|
88 |
|
336
|
89 |
self
|
|
90 |
logInfo:('%1 unit test classes collected'
|
|
91 |
bindWith:unitTestSuite tests size).
|
329
|
92 |
|
|
93 |
self logInfo:'starting unit tests'.
|
|
94 |
result := unitTestSuite
|
336
|
95 |
run:TestResultStX new
|
|
96 |
beforeEachDo:[:test | self logInfo:'performing unit test ', test printString]
|
|
97 |
afterEachDo:[:test| ]
|
|
98 |
debug:(cmdArgs includes:'--debug').
|
329
|
99 |
|
|
100 |
self logInfo:'generating report'.
|
|
101 |
TestResultReporter
|
336
|
102 |
report:result
|
|
103 |
format:#xml_jUnit
|
|
104 |
as:'testresult.xml'.
|
329
|
105 |
|
|
106 |
self logInfo:'summary:'.
|
|
107 |
self logInfo:('%1 tests' bindWith:result runCount).
|
|
108 |
self logInfo:('%1 passed' bindWith:result passedCount).
|
|
109 |
self logInfo:('%1 failed' bindWith:result failureCount).
|
|
110 |
self logInfo:('%1 errors' bindWith:result errorCount).
|
|
111 |
! !
|
|
112 |
|
|
113 |
!RunUnitTests class methodsFor:'constants'!
|
|
114 |
|
|
115 |
corruptedUnitTestClassNames
|
|
116 |
^ #(
|
336
|
117 |
#'RegressionTests::ExternalInterfaceTests'
|
|
118 |
#'RegressionTests::Win32OLETests'
|
|
119 |
#'RegressionTests::HTTPServerTests'
|
|
120 |
#'RegressionTests::SocketTests'
|
|
121 |
#'RegressionTests::DelayTest'
|
|
122 |
#'RegressionTests::ContextTest2'
|
|
123 |
#'RegressionTests::DebuggerTest'
|
|
124 |
#'RegressionTests::OperatingSystem'
|
329
|
125 |
)
|
|
126 |
!
|
|
127 |
|
|
128 |
excludedUnitTestClassNamesForAll
|
|
129 |
^ #()
|
|
130 |
!
|
|
131 |
|
336
|
132 |
excludedUnitTestClassNamesForExpecco
|
329
|
133 |
^ self excludedUnitTestClassNamesForAll
|
336
|
134 |
, #(
|
|
135 |
#'RegressionTests::BreakpointTests'
|
|
136 |
#'RegressionTests::SunitXMLOutputTest'
|
338
|
137 |
#'RegressionTests::CompilerTests2'
|
|
138 |
#'RegressionTests::BehaviorLookupObjectTests'
|
|
139 |
#'RegressionTests::ChangeSetTests'
|
|
140 |
#'RegressionTests::MakefileTests'
|
|
141 |
#'RegressionTests::MetaphoneStringComparatorTest'
|
|
142 |
#'RegressionTests::STCCompilerTests'
|
|
143 |
#'RegressionTests::VMCrashTests'
|
339
|
144 |
#'RegressionTests::SnapshotRestartTests'
|
336
|
145 |
)
|
329
|
146 |
! !
|
|
147 |
|
|
148 |
!RunUnitTests class methodsFor:'logging'!
|
|
149 |
|
|
150 |
log:aString
|
|
151 |
type:aType
|
|
152 |
|
336
|
153 |
Stdout
|
|
154 |
showCR:('%1 [%2] : %3'
|
|
155 |
bindWith:Timestamp now printString
|
|
156 |
with:(aType printString asLowercase paddedTo:'warning' size)
|
|
157 |
with:aString).
|
329
|
158 |
!
|
|
159 |
|
|
160 |
logInfo:aString
|
|
161 |
self
|
336
|
162 |
log:aString
|
|
163 |
type:'INFO'
|
329
|
164 |
!
|
|
165 |
|
|
166 |
logWarning:aString
|
|
167 |
self
|
336
|
168 |
log:aString
|
|
169 |
type:'WARNING'
|
329
|
170 |
! !
|