author | Claus Gittinger <cg@exept.de> |
Wed, 23 Mar 2016 23:08:42 +0100 | |
changeset 309 | 8061d7da3fc3 |
parent 306 | 27c40eee1d2b |
child 310 | 1fecaf68f3b4 |
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 |
"/ |
87 | 7 |
"/ use --debug to debug failed test cases. |
0 | 8 |
"/ |
309 | 9 |
"/ To use with jenkins (+ jUnit plugin): |
8 | 10 |
"/ use the following buildscript (in jenkins): |
3 | 11 |
"/ (after checkout of stx) |
12 |
"/ cd stx |
|
13 |
"/ call bmake |
|
14 |
"/ cd goodies\selftest |
|
15 |
"/ ..\..\projects\smalltalk\stx.com --noBanner -I --execute SelfTest.st |
|
16 |
"/ |
|
33 | 17 |
"/ and configure the jenkins junit plugin, to scan for "testresult.xml" |
309 | 18 |
"/ ------------------------------------------------------------------------------------ |
3 | 19 |
|
34 | 20 |
"/ tell the system, where stx is... |
21 |
ParserFlags initializeSTCFlagsForTopDirectory:'../../..'. |
|
22 |
||
0 | 23 |
Object infoPrinting:false. |
24 |
ObjectMemory infoPrinting:false. |
|
309 | 25 |
|
26 |
"/ install a global handler, which suppresses the updating of the change file |
|
0 | 27 |
Processor activeProcess exceptionHandlerSet |
28 |
on:(Class updateChangeFileQuerySignal) |
|
29 |
do:[:ex | ex proceedWith:false ]. |
|
30 |
! |
|
31 |
||
9 | 32 |
Stdout showCR:'Selftest Started'. |
0 | 33 |
! |
34 |
||
306 | 35 |
Smalltalk packagePath addFirst:'../../../..'. |
309 | 36 |
|
37 |
"/ ensure that some packages are present |
|
9 | 38 |
Stdout showCR:'Loading sunit...'. |
0 | 39 |
Smalltalk loadPackage:'stx:goodies/sunit'. |
297 | 40 |
self assert:(TestCase notNil and:[TestCase isLoaded]) message:'[Error]: Missing TestCase class after sunit package load'. |
0 | 41 |
|
22 | 42 |
"/ Smalltalk loadPackage:'stx:goodies/xml/vw'. |
43 |
"/ Smalltalk loadPackage:'stx:goodies/xml/stx'. |
|
87 | 44 |
Smalltalk loadPackage:'stx:libcompat'. |
47 | 45 |
Smalltalk loadPackage:'stx:libjavascript'. |
10 | 46 |
! |
47 |
||
301 | 48 |
|suite result debugging| |
0 | 49 |
|
15 | 50 |
Stdout showCR:'Creating suite...'. |
4 | 51 |
suite := TestSuite named:'SelfTest'. |
23 | 52 |
|
53 |
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
|
54 |
|
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
|
55 |
"To add a new test please edit exept_regression>>testCaseNamesWithoutNamespace" |
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
|
56 |
Smalltalk fileInClass:#'exept_regression' package:'exept:regression'. |
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 |
(Smalltalk at: #'exept_regression') isNil ifTrue:[ |
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
|
58 |
Stdout showCR:('ERROR: Ouch - missing class: "exept_regression"'). |
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
|
59 |
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
|
60 |
]. |
306 | 61 |
|
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 at: #'exept_regression') testCaseNamesWithoutNamespace do:[:className | |
23 | 63 |
|fullName| |
64 |
||
65 |
fullName := ('RegressionTests::',className). |
|
306 | 66 |
Stdout showCR:(' loading ',className,'...'). |
67 |
Error handle:[:ex | |
|
68 |
Stdout showCR:('**** Ouch - error while loading class: "',className,'"'). |
|
69 |
] do:[ |
|
70 |
Smalltalk fileInClass:fullName package:'exept:regression'. |
|
71 |
]. |
|
95 | 72 |
(Smalltalk classNamed:fullName) isNil ifTrue:[ |
73 |
Stdout showCR:('**** Ouch - missing class: "',fullName,'"'). |
|
74 |
] ifFalse:[ |
|
75 |
suite addTest:(Smalltalk classNamed:fullName) suite. |
|
76 |
] |
|
23 | 77 |
]. |
4 | 78 |
|
15 | 79 |
Stdout showCR:'Running suite...'. |
301 | 80 |
debugging := (Smalltalk commandLineArgumentNamed:'--debug') notNil. |
8 | 81 |
result := suite |
94 | 82 |
run:TestResultStX new beforeEachDo:[:test | |
15 | 83 |
Stdout showCR:('- running ',test printString). |
87 | 84 |
] |
301 | 85 |
afterEachDo:[:test| |
86 |
Stdout showCR:('- done ',test printString). |
|
87 |
] |
|
88 |
debug:debugging. |
|
23 | 89 |
|
38 | 90 |
Stdout showCR:'Generating report...'. |
8 | 91 |
TestResultReporter |
92 |
report:result |
|
29 | 93 |
format:#xml_jUnit |
8 | 94 |
as:'testresult.xml'. |
38 | 95 |
|
96 |
Stdout showCR:'Summary:'. |
|
97 |
Stdout showCR:(' %1 tests;' bindWith:result runCount). |
|
98 |
Stdout show:(' %1 passed,' bindWith:result passedCount). |
|
99 |
Stdout show:(' %1 failed,' bindWith:result failureCount). |
|
100 |
Stdout showCR:(' %1 errors.' bindWith:result errorCount). |
|
98 | 101 |
|
102 |
'metrics.xml' asFilename writingFileDo:[:stream | |
|
99 | 103 |
MetricsReporter new |
104 |
stream: stream; |
|
105 |
packages:{ |
|
106 |
'stx:libbasic' . |
|
107 |
'stx:libbasic2' . |
|
108 |
'stx:libbasic3' . |
|
109 |
'stx:libcomp' . |
|
110 |
'stx:libview' . |
|
111 |
'stx:libview2' . |
|
112 |
'stx:libwidg' . |
|
113 |
'stx:libwidg2' . |
|
114 |
'stx:libtool' . |
|
115 |
'stx:libtool2' . |
|
116 |
'stx:libui' . |
|
117 |
'stx:libhtml' . |
|
115 | 118 |
'stx:goodies/xml/vw' . |
99 | 119 |
'stx:goodies/soap' . |
120 |
'stx:libjavascript' . |
|
100 | 121 |
}; |
99 | 122 |
classMetricNames: #(); |
123 |
methodMetricNames: #(); |
|
124 |
packageMetricNames: #( 'LOC' 'NOM' 'NOC'); |
|
125 |
reportXml_metrics. |
|
98 | 126 |
]. |
127 |
||
0 | 128 |
! |