author | sr |
Fri, 17 Mar 2017 15:12:41 +0100 | |
changeset 327 | 8e05bbea7b0a |
parent 314 | 8247a65b0d86 |
child 331 | 684e2bfb46f4 |
permissions | -rw-r--r-- |
0 | 1 |
"/ |
87 | 2 |
"/ runs a number of tests from the exept:regression package (see list below) |
0 | 3 |
"/ execute this script using the following command line: |
4 |
"/ |
|
8 | 5 |
"/ stx --noBanner -I --execute SelfTest.st |
309 | 6 |
"/ |
310 | 7 |
"/ use |
8 |
"/ --debug to debug failed test cases. |
|
9 |
"/ --skipTests to skip tests |
|
10 |
"/ --skipMetrics to metric reports tests |
|
0 | 11 |
"/ |
309 | 12 |
"/ To use with jenkins (+ jUnit plugin): |
8 | 13 |
"/ use the following buildscript (in jenkins): |
3 | 14 |
"/ (after checkout of stx) |
15 |
"/ cd stx |
|
16 |
"/ call bmake |
|
17 |
"/ cd goodies\selftest |
|
18 |
"/ ..\..\projects\smalltalk\stx.com --noBanner -I --execute SelfTest.st |
|
19 |
"/ |
|
33 | 20 |
"/ and configure the jenkins junit plugin, to scan for "testresult.xml" |
309 | 21 |
"/ ------------------------------------------------------------------------------------ |
3 | 22 |
|
34 | 23 |
"/ tell the system, where stx is... |
24 |
ParserFlags initializeSTCFlagsForTopDirectory:'../../..'. |
|
25 |
||
0 | 26 |
Object infoPrinting:false. |
27 |
ObjectMemory infoPrinting:false. |
|
309 | 28 |
|
29 |
"/ install a global handler, which suppresses the updating of the change file |
|
0 | 30 |
Processor activeProcess exceptionHandlerSet |
31 |
on:(Class updateChangeFileQuerySignal) |
|
32 |
do:[:ex | ex proceedWith:false ]. |
|
33 |
! |
|
34 |
||
9 | 35 |
Stdout showCR:'Selftest Started'. |
0 | 36 |
! |
37 |
||
306 | 38 |
Smalltalk packagePath addFirst:'../../../..'. |
309 | 39 |
|
40 |
"/ ensure that some packages are present |
|
9 | 41 |
Stdout showCR:'Loading sunit...'. |
0 | 42 |
Smalltalk loadPackage:'stx:goodies/sunit'. |
297 | 43 |
self assert:(TestCase notNil and:[TestCase isLoaded]) message:'[Error]: Missing TestCase class after sunit package load'. |
0 | 44 |
|
22 | 45 |
"/ Smalltalk loadPackage:'stx:goodies/xml/vw'. |
46 |
"/ Smalltalk loadPackage:'stx:goodies/xml/stx'. |
|
87 | 47 |
Smalltalk loadPackage:'stx:libcompat'. |
47 | 48 |
Smalltalk loadPackage:'stx:libjavascript'. |
10 | 49 |
! |
50 |
||
301 | 51 |
|suite result debugging| |
0 | 52 |
|
15 | 53 |
Stdout showCR:'Creating suite...'. |
4 | 54 |
suite := TestSuite named:'SelfTest'. |
23 | 55 |
|
56 |
Stdout showCR:'Loading regression tests...'. |
|
130
ae4a40e279d6
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:
116
diff
changeset
|
57 |
|
327 | 58 |
"To add a new test please edit stx_goodies_regression>>testCaseNamesWithoutNamespace" |
59 |
Smalltalk fileInClass:#'stx_goodies_regression' package:'stx:goodies/regression'. |
|
60 |
(Smalltalk at: #'stx_goodies_regression') isNil ifTrue:[ |
|
61 |
Stdout showCR:('ERROR: Ouch - missing class: "stx_goodies_regression"'). |
|
130
ae4a40e279d6
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:
116
diff
changeset
|
62 |
Smalltalk exit: 1. |
ae4a40e279d6
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:
116
diff
changeset
|
63 |
]. |
306 | 64 |
|
327 | 65 |
(Smalltalk at: #'stx_goodies_regression') testCaseNamesWithoutNamespace do:[:className | |
23 | 66 |
|fullName| |
67 |
||
68 |
fullName := ('RegressionTests::',className). |
|
306 | 69 |
Stdout showCR:(' loading ',className,'...'). |
70 |
Error handle:[:ex | |
|
71 |
Stdout showCR:('**** Ouch - error while loading class: "',className,'"'). |
|
72 |
] do:[ |
|
327 | 73 |
Smalltalk fileInClass:fullName package:'stx:goodies/regression'. |
306 | 74 |
]. |
95 | 75 |
(Smalltalk classNamed:fullName) isNil ifTrue:[ |
76 |
Stdout showCR:('**** Ouch - missing class: "',fullName,'"'). |
|
77 |
] ifFalse:[ |
|
78 |
suite addTest:(Smalltalk classNamed:fullName) suite. |
|
79 |
] |
|
23 | 80 |
]. |
4 | 81 |
|
310 | 82 |
"/ |
83 |
"/ run the suite |
|
84 |
"/ |
|
311 | 85 |
(Smalltalk commandLineArguments includes:'--skipTests') ifTrue:[ |
310 | 86 |
Stdout showCR:'Skipping suite.'. |
87 |
] ifFalse:[ |
|
88 |
Stdout showCR:'Running suite...'. |
|
311 | 89 |
debugging := (Smalltalk commandLineArguments includes:'--debug'). |
310 | 90 |
result := suite |
91 |
run:TestResultStX new |
|
92 |
beforeEachDo:[:test | |
|
93 |
Stdout showCR:('- running ',test printString). |
|
94 |
] |
|
95 |
afterEachDo:[:test| |
|
96 |
Stdout showCR:('- done ',test printString). |
|
97 |
] |
|
98 |
debug:debugging. |
|
23 | 99 |
|
310 | 100 |
Stdout showCR:'Generating report...'. |
101 |
TestResultReporter |
|
102 |
report:result |
|
103 |
format:#xml_jUnit |
|
104 |
as:'testresult.xml'. |
|
38 | 105 |
|
310 | 106 |
Stdout showCR:'Summary:'. |
107 |
Stdout showCR:(' %1 tests;' bindWith:result runCount). |
|
108 |
Stdout show:(' %1 passed,' bindWith:result passedCount). |
|
109 |
Stdout show:(' %1 failed,' bindWith:result failureCount). |
|
110 |
Stdout showCR:(' %1 errors.' bindWith:result errorCount). |
|
111 |
]. |
|
98 | 112 |
|
310 | 113 |
"/ |
114 |
"/ generate a metrics report |
|
115 |
"/ |
|
116 |
#( |
|
117 |
'stx:libbasic' |
|
118 |
'stx:libbasic2' |
|
119 |
'stx:libbasic3' |
|
120 |
'stx:libcomp' |
|
121 |
'stx:libview' |
|
122 |
'stx:libview2' |
|
123 |
'stx:libwidg' |
|
124 |
'stx:libwidg2' |
|
125 |
'stx:libtool' |
|
126 |
'stx:libtool2' |
|
127 |
'stx:libui' |
|
128 |
'stx:libhtml' |
|
314 | 129 |
'stx:libboss' |
130 |
'stx:libdb' |
|
310 | 131 |
'stx:libjavascript' |
132 |
'stx:goodies/xml/stx' |
|
133 |
'stx:goodies/xml/yaxo' |
|
134 |
'stx:goodies/xml/xsl' |
|
135 |
'stx:goodies/xml/xpath' |
|
136 |
'stx:goodies/net' |
|
137 |
'stx:goodies/communication' |
|
138 |
'stx:goodies/webServer' |
|
139 |
'stx:goodies/soap' |
|
140 |
) do:[:p | Smalltalk loadPackage:p]. |
|
141 |
||
311 | 142 |
(Smalltalk commandLineArguments includes:'--skipMetrics') ifTrue:[ |
310 | 143 |
Stdout showCR:'Skipping metrics.'. |
144 |
] ifFalse:[ |
|
145 |
'metrics.xml' asFilename writingFileDo:[:stream | |
|
146 |
MetricsReporter new |
|
147 |
stream: stream; |
|
148 |
packages:{ |
|
149 |
'stx:*' . |
|
150 |
}; |
|
151 |
classMetricNames: #(); |
|
152 |
methodMetricNames: #(); |
|
153 |
packageMetricNames: #( 'LOC' 'NOM' 'NOC'); |
|
154 |
reportXml_metrics. |
|
155 |
]. |
|
98 | 156 |
]. |
157 |
||
0 | 158 |
! |