2 "/ runs a number of tests from the exept:regression package (see list below) |
2 "/ runs a number of tests from the exept:regression package (see list below) |
3 "/ execute this script using the following command line: |
3 "/ execute this script using the following command line: |
4 "/ |
4 "/ |
5 "/ stx --noBanner -I --execute SelfTest.st |
5 "/ stx --noBanner -I --execute SelfTest.st |
6 "/ |
6 "/ |
7 "/ use --debug to debug failed test cases. |
7 "/ use |
|
8 "/ --debug to debug failed test cases. |
|
9 "/ --skipTests to skip tests |
|
10 "/ --skipMetrics to metric reports tests |
8 "/ |
11 "/ |
9 "/ To use with jenkins (+ jUnit plugin): |
12 "/ To use with jenkins (+ jUnit plugin): |
10 "/ use the following buildscript (in jenkins): |
13 "/ use the following buildscript (in jenkins): |
11 "/ (after checkout of stx) |
14 "/ (after checkout of stx) |
12 "/ cd stx |
15 "/ cd stx |
74 ] ifFalse:[ |
77 ] ifFalse:[ |
75 suite addTest:(Smalltalk classNamed:fullName) suite. |
78 suite addTest:(Smalltalk classNamed:fullName) suite. |
76 ] |
79 ] |
77 ]. |
80 ]. |
78 |
81 |
79 Stdout showCR:'Running suite...'. |
82 "/ |
80 debugging := (Smalltalk commandLineArgumentNamed:'--debug') notNil. |
83 "/ run the suite |
81 result := suite |
84 "/ |
82 run:TestResultStX new beforeEachDo:[:test | |
85 (Smalltalk commandLineArgumentNamed:'--skipTests') notNil ifTrue:[ |
83 Stdout showCR:('- running ',test printString). |
86 Stdout showCR:'Skipping suite.'. |
84 ] |
87 ] ifFalse:[ |
85 afterEachDo:[:test| |
88 Stdout showCR:'Running suite...'. |
86 Stdout showCR:('- done ',test printString). |
89 debugging := (Smalltalk commandLineArgumentNamed:'--debug') notNil. |
87 ] |
90 result := suite |
88 debug:debugging. |
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. |
89 |
99 |
90 Stdout showCR:'Generating report...'. |
100 Stdout showCR:'Generating report...'. |
91 TestResultReporter |
101 TestResultReporter |
92 report:result |
102 report:result |
93 format:#xml_jUnit |
103 format:#xml_jUnit |
94 as:'testresult.xml'. |
104 as:'testresult.xml'. |
95 |
105 |
96 Stdout showCR:'Summary:'. |
106 Stdout showCR:'Summary:'. |
97 Stdout showCR:(' %1 tests;' bindWith:result runCount). |
107 Stdout showCR:(' %1 tests;' bindWith:result runCount). |
98 Stdout show:(' %1 passed,' bindWith:result passedCount). |
108 Stdout show:(' %1 passed,' bindWith:result passedCount). |
99 Stdout show:(' %1 failed,' bindWith:result failureCount). |
109 Stdout show:(' %1 failed,' bindWith:result failureCount). |
100 Stdout showCR:(' %1 errors.' bindWith:result errorCount). |
110 Stdout showCR:(' %1 errors.' bindWith:result errorCount). |
|
111 ]. |
101 |
112 |
102 'metrics.xml' asFilename writingFileDo:[:stream | |
113 "/ |
103 MetricsReporter new |
114 "/ generate a metrics report |
104 stream: stream; |
115 "/ |
105 packages:{ |
116 #( |
106 'stx:libbasic' . |
117 'stx:libbasic' |
107 'stx:libbasic2' . |
118 'stx:libbasic2' |
108 'stx:libbasic3' . |
119 'stx:libbasic3' |
109 'stx:libcomp' . |
120 'stx:libcomp' |
110 'stx:libview' . |
121 'stx:libview' |
111 'stx:libview2' . |
122 'stx:libview2' |
112 'stx:libwidg' . |
123 'stx:libwidg' |
113 'stx:libwidg2' . |
124 'stx:libwidg2' |
114 'stx:libtool' . |
125 'stx:libtool' |
115 'stx:libtool2' . |
126 'stx:libtool2' |
116 'stx:libui' . |
127 'stx:libui' |
117 'stx:libhtml' . |
128 'stx:libhtml' |
118 'stx:goodies/xml/vw' . |
129 'stx:libjavascript' |
119 'stx:goodies/soap' . |
130 'stx:goodies/xml/stx' |
120 'stx:libjavascript' . |
131 'stx:goodies/xml/yaxo' |
121 }; |
132 'stx:goodies/xml/xsl' |
122 classMetricNames: #(); |
133 'stx:goodies/xml/xpath' |
123 methodMetricNames: #(); |
134 'stx:goodies/net' |
124 packageMetricNames: #( 'LOC' 'NOM' 'NOC'); |
135 'stx:goodies/communication' |
125 reportXml_metrics. |
136 'stx:goodies/webServer' |
|
137 'stx:goodies/soap' |
|
138 ) do:[:p | Smalltalk loadPackage:p]. |
|
139 |
|
140 (Smalltalk commandLineArgumentNamed:'--skipMetrics') notNil ifTrue:[ |
|
141 Stdout showCR:'Skipping metrics.'. |
|
142 ] ifFalse:[ |
|
143 'metrics.xml' asFilename writingFileDo:[:stream | |
|
144 MetricsReporter new |
|
145 stream: stream; |
|
146 packages:{ |
|
147 'stx:*' . |
|
148 }; |
|
149 classMetricNames: #(); |
|
150 methodMetricNames: #(); |
|
151 packageMetricNames: #( 'LOC' 'NOM' 'NOC'); |
|
152 reportXml_metrics. |
|
153 ]. |
126 ]. |
154 ]. |
127 |
155 |
128 ! |
156 ! |