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