author | Claus Gittinger <cg@exept.de> |
Tue, 26 Mar 2019 18:29:38 +0100 | |
changeset 2182 | abba80b6780f |
parent 2131 | f1f27c18645c |
permissions | -rw-r--r-- |
2131 | 1 |
"{ Encoding: utf8 }" |
2 |
||
1447 | 3 |
"{ Package: 'stx:goodies/regression' }" |
717 | 4 |
|
5 |
"{ NameSpace: RegressionTests }" |
|
6 |
||
7 |
Object subclass:#QuickTestRunner |
|
1447 | 8 |
instanceVariableNames:'suite anyError result' |
9 |
classVariableNames:'' |
|
10 |
poolDictionaries:'' |
|
11 |
category:'tests-Regression' |
|
717 | 12 |
! |
13 |
||
14 |
!QuickTestRunner class methodsFor:'documentation'! |
|
15 |
||
16 |
documentation |
|
17 |
" |
|
18 |
ATTENTION: if you change anything here, please verify compatibility with the |
|
1466 | 19 |
SeltTestRunner script found in stx/goodies/regression. |
717 | 20 |
|
21 |
This is meant to be called via a script or command-line argument, when executing |
|
22 |
selftests via jenkins. |
|
23 |
||
1447 | 24 |
Runs a number of tests from the stx:goodies/regression package (see list below) |
717 | 25 |
executed through SelfTestRunner script using the following command line: |
26 |
||
27 |
stx --noBanner -I --execute SelfTestRunner.st |
|
28 |
use --debug to debug failed test cases. |
|
29 |
||
30 |
to use with jenkins (+ jUnit plugin): |
|
31 |
use the following buildscript (in jenkins): |
|
32 |
(after checkout of stx) |
|
1447 | 33 |
cd stx |
34 |
call bmake |
|
35 |
cd goodies\selftest |
|
36 |
..\..\projects\smalltalk\stx.com --noBanner -I --execute SelfTestRunner.st |
|
717 | 37 |
|
38 |
and configure the jenkins junit plugin, to scan for 'testresult.xml' |
|
39 |
||
40 |
[author:] |
|
1447 | 41 |
Claus Gittinger |
717 | 42 |
|
43 |
[instance variables:] |
|
44 |
||
45 |
[class variables:] |
|
46 |
||
47 |
[see also:] |
|
48 |
||
49 |
" |
|
50 |
! ! |
|
51 |
||
52 |
!QuickTestRunner class methodsFor:'instance creation'! |
|
53 |
||
54 |
new |
|
55 |
"return an initialized instance" |
|
56 |
||
57 |
^ self basicNew initialize. |
|
58 |
! ! |
|
59 |
||
60 |
!QuickTestRunner class methodsFor:'execution'! |
|
61 |
||
62 |
start |
|
63 |
|runner| |
|
64 |
||
65 |
runner := self new. |
|
66 |
runner |
|
1447 | 67 |
prepare; |
68 |
buildSuite; |
|
69 |
runSuite. |
|
717 | 70 |
|
71 |
Smalltalk isStandAloneApp ifTrue:[ |
|
1447 | 72 |
Smalltalk exit:(runner anyError ifTrue:[1] ifFalse:[0]) |
717 | 73 |
]. |
74 |
! ! |
|
75 |
||
76 |
!QuickTestRunner methodsFor:'execution'! |
|
77 |
||
78 |
buildSuite |
|
79 |
|anyMissing| |
|
80 |
||
81 |
anyMissing := false. |
|
82 |
||
83 |
Stdout showCR:'Creating suite...'. |
|
84 |
suite := TestSuite named:'SelfTest'. |
|
85 |
||
86 |
Stdout showCR:'Loading regression tests...'. |
|
87 |
self listOfTestClasses do:[:className | |
|
1447 | 88 |
|fullName| |
717 | 89 |
|
1447 | 90 |
fullName := ('RegressionTests::',className). |
91 |
Stdout showCR:('Loading ',className,'...'). |
|
92 |
Smalltalk fileInClass:fullName package:'stx:goodies/regression'. |
|
93 |
(Smalltalk classNamed:fullName) isNil ifTrue:[ |
|
94 |
Stdout showCR:('**** Ouch - missing class: "',fullName,'"'). |
|
95 |
anyMissing := true. |
|
96 |
] ifFalse:[ |
|
97 |
suite addTest:(Smalltalk classNamed:fullName) suite. |
|
98 |
] |
|
717 | 99 |
]. |
100 |
||
101 |
anyError := anyError | anyMissing. |
|
102 |
! |
|
103 |
||
104 |
generateReport |
|
105 |
Stdout showCR:'Generating report...'. |
|
2131 | 106 |
|
717 | 107 |
TestResultReporter |
2131 | 108 |
report:result |
109 |
format:#xml_jUnit |
|
110 |
as:'testresult.xml'. |
|
717 | 111 |
|
2131 | 112 |
Stdout showCR:'Summary: %1 tests;' with:result runCount. |
113 |
Stdout show:' %1 passed,' with:result passedCount. |
|
114 |
Stdout show:' %1 skipped,' with:result skippedCount. |
|
115 |
Stdout show:' %1 failed, %1 errors.' with:result failureCount with:result errorCount. |
|
116 |
||
117 |
"Modified: / 23-03-2019 / 10:19:25 / Claus Gittinger" |
|
717 | 118 |
! |
119 |
||
120 |
listOfTestClasses |
|
844
f54aa16c1732
List of tests moved to one place so it is always the same for all three test runners (sigh, we have three different!)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
810
diff
changeset
|
121 |
"*** IMPORTANT *** " |
1462 | 122 |
"* To add a new test please edit stx_goodies_regression>>testCaseNamesWithoutNamespace" |
844
f54aa16c1732
List of tests moved to one place so it is always the same for all three test runners (sigh, we have three different!)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
810
diff
changeset
|
123 |
"*** ********* *** " |
1462 | 124 |
Smalltalk fileInClass:#'stx_goodies_regression' package:'stx:goodies/regression'. |
125 |
(Smalltalk at: #'stx_goodies_regression') isNil ifTrue:[ |
|
126 |
Stdout showCR:('ERROR: Ouch - missing class: "stx_goodies_regression"'). |
|
1447 | 127 |
Stdout showCR:('EXIT'). |
128 |
Smalltalk exit: 1. |
|
844
f54aa16c1732
List of tests moved to one place so it is always the same for all three test runners (sigh, we have three different!)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
810
diff
changeset
|
129 |
]. |
1462 | 130 |
^(Smalltalk at: #'stx_goodies_regression') testCaseNamesWithoutNamespace |
769 | 131 |
|
810 | 132 |
"Modified: / 21-02-2013 / 18:05:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
717 | 133 |
! |
134 |
||
135 |
prepare |
|
136 |
"/ tell the system, where stx is... |
|
137 |
||
138 |
|top| |
|
139 |
||
140 |
top := Smalltalk packageDirectoryForPackageId:'stx'. |
|
141 |
"/ top := '../../..'. |
|
142 |
||
143 |
ParserFlags initializeSTCFlagsForTopDirectory:top. |
|
144 |
||
145 |
Object infoPrinting:false. |
|
146 |
ObjectMemory infoPrinting:false. |
|
147 |
||
148 |
Processor activeProcess exceptionHandlerSet |
|
1447 | 149 |
on:(Class updateChangeFileQuerySignal) |
150 |
do:[:ex | ex proceedWith:false ]. |
|
717 | 151 |
|
152 |
Stdout showCR:'Selftest Started'. |
|
153 |
||
154 |
Stdout showCR:'Loading sunit...'. |
|
155 |
Smalltalk loadPackage:'stx:goodies/sunit'. |
|
156 |
self assert:(TestCase notNil and:[TestCase isLoaded]). |
|
157 |
||
158 |
Smalltalk loadPackage:'stx:libcompat'. |
|
159 |
Smalltalk loadPackage:'stx:libjavascript'. |
|
808 | 160 |
Smalltalk loadPackage:'exept:libcrypt'. |
717 | 161 |
! |
162 |
||
163 |
runSuite |
|
164 |
Stdout showCR:'Running suite...'. |
|
165 |
result := suite |
|
1447 | 166 |
run:TestResultStX new beforeEachDo:[:test | |
167 |
Stdout showCR:('- running ',test printString). |
|
168 |
] |
|
169 |
afterEachDo:[:test| ] |
|
170 |
debug:(Smalltalk commandLineArgumentNamed:'--debug') notNil. |
|
717 | 171 |
! ! |
172 |
||
173 |
!QuickTestRunner methodsFor:'initialization'! |
|
174 |
||
175 |
initialize |
|
176 |
anyError := false. |
|
177 |
! ! |
|
178 |
||
179 |
!QuickTestRunner class methodsFor:'documentation'! |
|
180 |
||
181 |
version |
|
182 |
^ '$Header$' |
|
183 |
! |
|
184 |
||
185 |
version_CVS |
|
186 |
^ '$Header$' |
|
187 |
! ! |
|
2131 | 188 |