*** empty log message ***
authorsr
Tue, 21 Mar 2017 16:04:15 +0100
changeset 33144fde0482a1c
parent 330 6a3fe7cea4e1
child 333 a7d1a4a65b39
*** empty log message ***
quickSelfTest/SelfTest.st
     1.1 --- a/quickSelfTest/SelfTest.st	Tue Mar 21 16:03:37 2017 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,158 +0,0 @@
     1.4 -"/
     1.5 -"/ runs a number of tests from the exept:regression package (see list below)
     1.6 -"/ execute this script using the following command line:
     1.7 -"/
     1.8 -"/ stx --noBanner -I --execute SelfTest.st
     1.9 -"/
    1.10 -"/   use
    1.11 -"/      --debug to debug failed test cases.
    1.12 -"/      --skipTests to skip tests
    1.13 -"/      --skipMetrics to metric reports tests
    1.14 -"/
    1.15 -"/ To use with jenkins (+ jUnit plugin):
    1.16 -"/ use the following buildscript (in jenkins):
    1.17 -"/ (after checkout of stx)
    1.18 -"/      cd stx
    1.19 -"/      call bmake
    1.20 -"/      cd goodies\selftest
    1.21 -"/      ..\..\projects\smalltalk\stx.com --noBanner -I --execute SelfTest.st
    1.22 -"/
    1.23 -"/ and configure the jenkins junit plugin, to scan for "testresult.xml"
    1.24 -"/ ------------------------------------------------------------------------------------
    1.25 -
    1.26 -"/ tell the system, where stx is...
    1.27 -ParserFlags initializeSTCFlagsForTopDirectory:'../../..'.
    1.28 -
    1.29 -Object infoPrinting:false.
    1.30 -ObjectMemory infoPrinting:false.
    1.31 -
    1.32 -"/ install a global handler, which suppresses the updating of the change file
    1.33 -Processor activeProcess exceptionHandlerSet
    1.34 -    on:(Class updateChangeFileQuerySignal)
    1.35 -    do:[:ex | ex proceedWith:false ].
    1.36 -!
    1.37 -
    1.38 -Stdout showCR:'Selftest Started'.
    1.39 -!
    1.40 -
    1.41 -Smalltalk packagePath addFirst:'../../../..'.
    1.42 -
    1.43 -"/ ensure that some packages are present
    1.44 -Stdout showCR:'Loading sunit...'.
    1.45 -Smalltalk loadPackage:'stx:goodies/sunit'.
    1.46 -self assert:(TestCase notNil and:[TestCase isLoaded]) message:'[Error]: Missing TestCase class after sunit package load'.
    1.47 -
    1.48 -"/ Smalltalk loadPackage:'stx:goodies/xml/vw'.
    1.49 -"/ Smalltalk loadPackage:'stx:goodies/xml/stx'.
    1.50 -Smalltalk loadPackage:'stx:libcompat'.
    1.51 -Smalltalk loadPackage:'stx:libjavascript'.
    1.52 -!
    1.53 -
    1.54 -|suite result debugging|
    1.55 -
    1.56 -Stdout showCR:'Creating suite...'.
    1.57 -suite := TestSuite named:'SelfTest'.
    1.58 -
    1.59 -Stdout showCR:'Loading regression tests...'.
    1.60 -
    1.61 -"To add a new test please edit stx_goodies_regression>>testCaseNamesWithoutNamespace"
    1.62 -Smalltalk fileInClass:#'stx_goodies_regression' package:'stx:goodies/regression'.
    1.63 -(Smalltalk at: #'stx_goodies_regression') isNil ifTrue:[
    1.64 -    Stdout showCR:('ERROR: Ouch - missing class: "stx_goodies_regression"').
    1.65 -    Smalltalk exit: 1.
    1.66 -].
    1.67 -
    1.68 -(Smalltalk at: #'stx_goodies_regression') testCaseNamesWithoutNamespace do:[:className |
    1.69 -    |fullName|
    1.70 -
    1.71 -    fullName := ('RegressionTests::',className).
    1.72 -    Stdout showCR:('  loading ',className,'...').
    1.73 -    Error handle:[:ex |
    1.74 -	Stdout showCR:('**** Ouch - error while loading class: "',className,'"').
    1.75 -    ] do:[
    1.76 -	Smalltalk fileInClass:fullName package:'stx:goodies/regression'.
    1.77 -    ].
    1.78 -    (Smalltalk classNamed:fullName) isNil ifTrue:[
    1.79 -	Stdout showCR:('**** Ouch - missing class: "',fullName,'"').
    1.80 -    ] ifFalse:[
    1.81 -	suite addTest:(Smalltalk classNamed:fullName) suite.
    1.82 -    ]
    1.83 -].
    1.84 -
    1.85 -"/
    1.86 -"/ run the suite
    1.87 -"/
    1.88 -(Smalltalk commandLineArguments includes:'--skipTests') ifTrue:[
    1.89 -    Stdout showCR:'Skipping suite.'.
    1.90 -] ifFalse:[
    1.91 -    Stdout showCR:'Running suite...'.
    1.92 -    debugging := (Smalltalk commandLineArguments includes:'--debug').
    1.93 -    result := suite
    1.94 -		run:TestResultStX new
    1.95 -		beforeEachDo:[:test |
    1.96 -		    Stdout showCR:('- running ',test printString).
    1.97 -		]
    1.98 -		afterEachDo:[:test|
    1.99 -		    Stdout showCR:('- done ',test printString).
   1.100 -		]
   1.101 -		debug:debugging.
   1.102 -
   1.103 -    Stdout showCR:'Generating report...'.
   1.104 -    TestResultReporter
   1.105 -	report:result
   1.106 -	format:#xml_jUnit
   1.107 -	as:'testresult.xml'.
   1.108 -
   1.109 -    Stdout showCR:'Summary:'.
   1.110 -    Stdout showCR:('  %1 tests;' bindWith:result runCount).
   1.111 -    Stdout show:('  %1 passed,' bindWith:result passedCount).
   1.112 -    Stdout show:(' %1 failed,' bindWith:result failureCount).
   1.113 -    Stdout showCR:(' %1 errors.' bindWith:result errorCount).
   1.114 -].
   1.115 -
   1.116 -"/
   1.117 -"/ generate a metrics report
   1.118 -"/
   1.119 -#(
   1.120 -	    'stx:libbasic'
   1.121 -	    'stx:libbasic2'
   1.122 -	    'stx:libbasic3'
   1.123 -	    'stx:libcomp'
   1.124 -	    'stx:libview'
   1.125 -	    'stx:libview2'
   1.126 -	    'stx:libwidg'
   1.127 -	    'stx:libwidg2'
   1.128 -	    'stx:libtool'
   1.129 -	    'stx:libtool2'
   1.130 -	    'stx:libui'
   1.131 -	    'stx:libhtml'
   1.132 -	    'stx:libboss'
   1.133 -	    'stx:libdb'
   1.134 -	    'stx:libjavascript'
   1.135 -	    'stx:goodies/xml/stx'
   1.136 -	    'stx:goodies/xml/yaxo'
   1.137 -	    'stx:goodies/xml/xsl'
   1.138 -	    'stx:goodies/xml/xpath'
   1.139 -	    'stx:goodies/net'
   1.140 -	    'stx:goodies/communication'
   1.141 -	    'stx:goodies/webServer'
   1.142 -	    'stx:goodies/soap'
   1.143 -) do:[:p | Smalltalk loadPackage:p].
   1.144 -
   1.145 -(Smalltalk commandLineArguments includes:'--skipMetrics') ifTrue:[
   1.146 -    Stdout showCR:'Skipping metrics.'.
   1.147 -] ifFalse:[
   1.148 -    'metrics.xml' asFilename writingFileDo:[:stream |
   1.149 -	MetricsReporter new
   1.150 -	    stream: stream;
   1.151 -	    packages:{
   1.152 -		'stx:*'       .
   1.153 -	    };
   1.154 -	    classMetricNames: #();
   1.155 -	    methodMetricNames: #();
   1.156 -	    packageMetricNames: #( 'LOC' 'NOM' 'NOC');
   1.157 -	    reportXml_metrics.
   1.158 -    ].
   1.159 -].
   1.160 -
   1.161 -!