RegressionTests__QuickTestRunner.st
changeset 808 b51c32fe6bbb
parent 807 ef0d821a5f02
child 810 fea452689108
equal deleted inserted replaced
807:ef0d821a5f02 808:b51c32fe6bbb
    12 !QuickTestRunner class methodsFor:'documentation'!
    12 !QuickTestRunner class methodsFor:'documentation'!
    13 
    13 
    14 documentation
    14 documentation
    15 "
    15 "
    16     ATTENTION: if you change anything here, please verify compatibility with the
    16     ATTENTION: if you change anything here, please verify compatibility with the
    17                SeltTestRunner script found in exept/regression.
    17 	       SeltTestRunner script found in exept/regression.
    18 
    18 
    19     This is meant to be called via a script or command-line argument, when executing
    19     This is meant to be called via a script or command-line argument, when executing
    20     selftests via jenkins.
    20     selftests via jenkins.
    21 
    21 
    22     Runs a number of tests from the exept:regression package (see list below)
    22     Runs a number of tests from the exept:regression package (see list below)
    26       use --debug to debug failed test cases.
    26       use --debug to debug failed test cases.
    27 
    27 
    28     to use with jenkins (+ jUnit plugin):
    28     to use with jenkins (+ jUnit plugin):
    29     use the following buildscript (in jenkins):
    29     use the following buildscript (in jenkins):
    30     (after checkout of stx)
    30     (after checkout of stx)
    31          cd stx
    31 	 cd stx
    32          call bmake
    32 	 call bmake
    33          cd goodies\selftest
    33 	 cd goodies\selftest
    34          ..\..\projects\smalltalk\stx.com --noBanner -I --execute SelfTestRunner.st
    34 	 ..\..\projects\smalltalk\stx.com --noBanner -I --execute SelfTestRunner.st
    35 
    35 
    36     and configure the jenkins junit plugin, to scan for 'testresult.xml'
    36     and configure the jenkins junit plugin, to scan for 'testresult.xml'
    37 
    37 
    38     [author:]
    38     [author:]
    39         Claus Gittinger
    39 	Claus Gittinger
    40 
    40 
    41     [instance variables:]
    41     [instance variables:]
    42 
    42 
    43     [class variables:]
    43     [class variables:]
    44 
    44 
    60 start
    60 start
    61     |runner|
    61     |runner|
    62 
    62 
    63     runner := self new.
    63     runner := self new.
    64     runner
    64     runner
    65         prepare;
    65 	prepare;
    66         buildSuite;
    66 	buildSuite;
    67         runSuite.
    67 	runSuite.
    68 
    68 
    69     Smalltalk isStandAloneApp ifTrue:[
    69     Smalltalk isStandAloneApp ifTrue:[
    70         Smalltalk exit:(runner anyError ifTrue:[1] ifFalse:[0])
    70 	Smalltalk exit:(runner anyError ifTrue:[1] ifFalse:[0])
    71     ].
    71     ].
    72 ! !
    72 ! !
    73 
    73 
    74 !QuickTestRunner methodsFor:'execution'!
    74 !QuickTestRunner methodsFor:'execution'!
    75 
    75 
    81     Stdout showCR:'Creating suite...'.
    81     Stdout showCR:'Creating suite...'.
    82     suite := TestSuite named:'SelfTest'.
    82     suite := TestSuite named:'SelfTest'.
    83 
    83 
    84     Stdout showCR:'Loading regression tests...'.
    84     Stdout showCR:'Loading regression tests...'.
    85     self listOfTestClasses do:[:className |
    85     self listOfTestClasses do:[:className |
    86         |fullName|
    86 	|fullName|
    87 
    87 
    88         fullName := ('RegressionTests::',className).
    88 	fullName := ('RegressionTests::',className).
    89         Stdout showCR:('Loading ',className,'...').
    89 	Stdout showCR:('Loading ',className,'...').
    90         Smalltalk fileInClass:fullName package:'exept:regression'.
    90 	Smalltalk fileInClass:fullName package:'exept:regression'.
    91         (Smalltalk classNamed:fullName) isNil ifTrue:[
    91 	(Smalltalk classNamed:fullName) isNil ifTrue:[
    92             Stdout showCR:('**** Ouch - missing class: "',fullName,'"').
    92 	    Stdout showCR:('**** Ouch - missing class: "',fullName,'"').
    93             anyMissing := true.
    93 	    anyMissing := true.
    94         ] ifFalse:[
    94 	] ifFalse:[
    95             suite addTest:(Smalltalk classNamed:fullName) suite.
    95 	    suite addTest:(Smalltalk classNamed:fullName) suite.
    96         ]
    96 	]
    97     ].
    97     ].
    98 
    98 
    99     anyError := anyError | anyMissing.
    99     anyError := anyError | anyMissing.
   100 !
   100 !
   101 
   101 
   102 generateReport
   102 generateReport
   103     Stdout showCR:'Generating report...'.
   103     Stdout showCR:'Generating report...'.
   104     TestResultReporter
   104     TestResultReporter
   105         report:result
   105 	report:result
   106         format:#xml_jUnit
   106 	format:#xml_jUnit
   107         as:'testresult.xml'.
   107 	as:'testresult.xml'.
   108 
   108 
   109     Stdout showCR:'Summary:'.
   109     Stdout showCR:'Summary:'.
   110     Stdout showCR:('  %1 tests;' bindWith:result runCount).
   110     Stdout showCR:('  %1 tests;' bindWith:result runCount).
   111     Stdout show:('  %1 passed,' bindWith:result passedCount).
   111     Stdout show:('  %1 passed,' bindWith:result passedCount).
   112     Stdout show:(' %1 failed,' bindWith:result failureCount).
   112     Stdout show:(' %1 failed,' bindWith:result failureCount).
   114 !
   114 !
   115 
   115 
   116 listOfTestClasses
   116 listOfTestClasses
   117     ^ #(
   117     ^ #(
   118 
   118 
   119         "/ 'SunitXMLOutputTest'
   119 	"/ 'SunitXMLOutputTest'
   120         'CoverageInstrumentationTest'
   120 	'CoverageInstrumentationTest'
   121         'AssociationTests'
   121 	'AssociationTests'
   122         'BinaryIOTests'
   122 	'BinaryIOTests'
   123         'BinaryTreeTester'
   123 	'BinaryTreeTester'
   124         "/ 'BlockTest'
   124 	"/ 'BlockTest'
   125         'CharacterTests'
   125 	'CharacterTests'
   126         'CollectionTests'
   126 	'CollectionTests'
   127         'CompilerTest'
   127 	'CompilerTest'
   128         'ComplexTest'
   128 	'ComplexTest'
   129         'CryptTests'
   129 	'CryptTests'
   130         'STCCompilerTests'
   130 	'STCCompilerTests'
   131         "/ 'DebuggerTest'
   131 	"/ 'DebuggerTest'
   132         "/ 'DeepCopyTests'
   132 	"/ 'DeepCopyTests'
   133         'DelayTest'
   133 	'DelayTest'
   134         'DictionaryTest'
   134 	'DictionaryTest'
   135         'EnumerationTests'
   135 	'EnumerationTests'
   136         'ExceptionTest'
   136 	'ExceptionTest'
   137         "/ 'ExternalInterfaceTests'
   137 	"/ 'ExternalInterfaceTests'
   138         "/ 'FileOpenTest'
   138 	"/ 'FileOpenTest'
   139         'FileStreamTest'
   139 	'FileStreamTest'
   140         'FloatTest'
   140 	'FloatTest'
   141         'FractionTest'
   141 	'FractionTest'
   142         "/ 'GCTest'
   142 	"/ 'GCTest'
   143         "/ 'GraphicDrawingTest'
   143 	"/ 'GraphicDrawingTest'
   144         "/ 'HTMLParserTests'
   144 	"/ 'HTMLParserTests'
   145         "/ 'ImageReaderTest'
   145 	"/ 'ImageReaderTest'
   146         'IntegerTest'
   146 	'IntegerTest'
   147         'JavaScriptTests'
   147 	'JavaScriptTests'
   148         "/ 'MeasurementValueTests'
   148 	"/ 'MeasurementValueTests'
   149         "/ 'MemoryTest'
   149 	"/ 'MemoryTest'
   150         'NumberTest'
   150 	'NumberTest'
   151         "/ 'ParserTest'
   151 	"/ 'ParserTest'
   152         'ScaledDecimalTest'
   152 	'ScaledDecimalTest'
   153         "/ 'SemaphoreTest'
   153 	"/ 'SemaphoreTest'
   154         "/ 'SharedQueueTest'
   154 	"/ 'SharedQueueTest'
   155         'SmallIntegerTest'
   155 	'SmallIntegerTest'
   156         "/ 'SortTests'
   156 	"/ 'SortTests'
   157         'StringTests'
   157 	'StringTests'
   158         'StreamTests'
   158 	'StreamTests'
   159         'TimeAndDateTest'
   159 	'TimeAndDateTest'
   160         'TimeDurationTest'
   160 	'TimeDurationTest'
   161         "/ 'URLTest'
   161 	"/ 'URLTest'
   162         "/ 'XMLCoderTests'
   162 	"/ 'XMLCoderTests'
   163         "/ 'ZipArchiveTests'
   163 	"/ 'ZipArchiveTests'
   164         'ClassBuilderTests'
   164 	'ClassBuilderTests'
   165         'CompilerTests2'
   165 	'CompilerTests2'
   166         'ChangeSetTests'
   166 	'ChangeSetTests'
   167     )
   167     )
   168 
   168 
   169     "Modified: / 12-02-2013 / 16:34:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   169     "Modified: / 12-02-2013 / 16:34:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   170 !
   170 !
   171 
   171 
   181 
   181 
   182     Object infoPrinting:false.
   182     Object infoPrinting:false.
   183     ObjectMemory infoPrinting:false.
   183     ObjectMemory infoPrinting:false.
   184 
   184 
   185     Processor activeProcess exceptionHandlerSet
   185     Processor activeProcess exceptionHandlerSet
   186         on:(Class updateChangeFileQuerySignal)
   186 	on:(Class updateChangeFileQuerySignal)
   187         do:[:ex | ex proceedWith:false ].
   187 	do:[:ex | ex proceedWith:false ].
   188 
   188 
   189     Stdout showCR:'Selftest Started'.
   189     Stdout showCR:'Selftest Started'.
   190 
   190 
   191     Stdout showCR:'Loading sunit...'.
   191     Stdout showCR:'Loading sunit...'.
   192     Smalltalk loadPackage:'stx:goodies/sunit'.
   192     Smalltalk loadPackage:'stx:goodies/sunit'.
   193     self assert:(TestCase notNil and:[TestCase isLoaded]).
   193     self assert:(TestCase notNil and:[TestCase isLoaded]).
   194 
   194 
   195     Smalltalk loadPackage:'stx:libcompat'.
   195     Smalltalk loadPackage:'stx:libcompat'.
   196     Smalltalk loadPackage:'stx:libjavascript'.
   196     Smalltalk loadPackage:'stx:libjavascript'.
       
   197     Smalltalk loadPackage:'exept:libcrypt'.
   197 !
   198 !
   198 
   199 
   199 runSuite
   200 runSuite
   200     Stdout showCR:'Running suite...'.
   201     Stdout showCR:'Running suite...'.
   201     result := suite
   202     result := suite
   202                 run:TestResultStX new beforeEachDo:[:test |
   203 		run:TestResultStX new beforeEachDo:[:test |
   203                     Stdout showCR:('- running ',test printString).
   204 		    Stdout showCR:('- running ',test printString).
   204                 ]
   205 		]
   205                 afterEachDo:[:test| ]
   206 		afterEachDo:[:test| ]
   206                 debug:(Smalltalk commandLineArgumentNamed:'--debug') notNil.
   207 		debug:(Smalltalk commandLineArgumentNamed:'--debug') notNil.
   207 ! !
   208 ! !
   208 
   209 
   209 !QuickTestRunner methodsFor:'initialization'!
   210 !QuickTestRunner methodsFor:'initialization'!
   210 
   211 
   211 initialize
   212 initialize
   219 !
   220 !
   220 
   221 
   221 version_CVS
   222 version_CVS
   222     ^ '$Header$'
   223     ^ '$Header$'
   223 ! !
   224 ! !
   224