*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Thu, 28 Mar 2019 13:54:53 +0100
changeset 544fda58d35b323
parent 543 0b90cc7fc11a
child 545 9aede77e9c34
*** empty log message ***
quickSelfTest/README
quickSelfTest/RunUnitTests.st
     1.1 --- a/quickSelfTest/README	Thu Mar 28 13:54:42 2019 +0100
     1.2 +++ b/quickSelfTest/README	Thu Mar 28 13:54:53 2019 +0100
     1.3 @@ -14,8 +14,9 @@
     1.4  Start.st will prepare the stx environment required for the unit test.
     1.5  For e.g. loading required packages.
     1.6  
     1.7 -The last command of Start.st will file in RunUnitTest.st class and send #run.
     1.8 +The last command of Start.st will fileIn the RunUnitTest.st class
     1.9 +and send it a #run message.
    1.10  The RunUnitTest class will perform all unit tests
    1.11  (or a subset with the --runOnlyExpeccoUnitTests
    1.12 -or --runOnly xxx parameter)
    1.13 -and create a report file
    1.14 + or --runOnly xxx parameter)
    1.15 +and create a report file.
     2.1 --- a/quickSelfTest/RunUnitTests.st	Thu Mar 28 13:54:42 2019 +0100
     2.2 +++ b/quickSelfTest/RunUnitTests.st	Thu Mar 28 13:54:53 2019 +0100
     2.3 @@ -18,7 +18,7 @@
     2.4      typically invoked by RunUnitTestsStart
     2.5  
     2.6      [author:]
     2.7 -        sr
     2.8 +	sr
     2.9  
    2.10      [instance variables:]
    2.11  
    2.12 @@ -67,142 +67,153 @@
    2.13  
    2.14      index := arguments indexOf:'--settingsFile'.
    2.15      index > 0 ifTrue:[
    2.16 -        settingsFilePathName := arguments at:index + 1.
    2.17 -        self logInfo:'load settings file: ', settingsFilePathName printString.
    2.18 -        settingsFilePathName asFilename fileIn.
    2.19 -        self logInfo:'ParserFlags makeCommand: ', ParserFlags makeCommand printString.
    2.20 +	settingsFilePathName := arguments at:index + 1.
    2.21 +	self logInfo:'load settings file: %1' with:settingsFilePathName.
    2.22 +	settingsFilePathName asFilename fileIn.
    2.23 +	self logInfo:'makeCommand (from ParserFlags) is: %1' with:(ParserFlags makeCommand).
    2.24      ].
    2.25  
    2.26      (arguments includes:'--runOnlyExpeccoUnitTests') ifTrue:[
    2.27 -        self logInfo:'configured to run expecco unit tests only'.
    2.28 -        doRunSpecificUnitTests := true.
    2.29 -        unitTestSuiteName := 'expecco Unit Tests'.
    2.30 -        excludedUnitTestClassNames := self excludedUnitTestClassNamesForExpecco.
    2.31 +	self logInfo:'configured to run expecco unit tests only'.
    2.32 +	doRunSpecificUnitTests := true.
    2.33 +	unitTestSuiteName := 'expecco Unit Tests'.
    2.34 +	excludedUnitTestClassNames := self excludedUnitTestClassNamesForExpecco.
    2.35      ].
    2.36  
    2.37      index := arguments indexOf:'--resultFile'.
    2.38      index > 0 ifTrue:[
    2.39 -        resultFilePathName := arguments at:index + 1.
    2.40 -        self logInfo:'set custom result file: ', resultFilePathName printString.
    2.41 +	resultFilePathName := arguments at:index + 1.
    2.42 +	self logInfo:'set custom result file: %1' with:resultFilePathName.
    2.43      ].
    2.44  
    2.45 -    [   
    2.46 -        (index := arguments indexOf:'--run') > 0 
    2.47 +    [
    2.48 +	(index := arguments indexOf:'--run') > 0
    2.49      ] whileTrue:[
    2.50 -        runTestCases add:(arguments at:index + 1).
    2.51 -        self logInfo:'run test case: ', (arguments at:index + 1) printString.
    2.52 -        arguments removeIndex:index + 1.
    2.53 -        arguments removeIndex:index.
    2.54 +	runTestCases add:(arguments at:index + 1).
    2.55 +	self logInfo:'run test: "%1"' with:(arguments at:index + 1).
    2.56 +	arguments removeIndex:index + 1.
    2.57 +	arguments removeIndex:index.
    2.58      ].
    2.59 -    
    2.60 +
    2.61 +    [
    2.62 +	(index := arguments indexOf:'--exclude') > 0
    2.63 +    ] whileTrue:[
    2.64 +	excludedUnitTestClassNames add:(arguments at:index + 1).
    2.65 +	self logInfo:'exclude test: "%1"' with:(arguments at:index + 1).
    2.66 +	arguments removeIndex:index + 1.
    2.67 +	arguments removeIndex:index.
    2.68 +    ].
    2.69 +
    2.70      index := arguments indexOf:'--forceTestCase'.
    2.71      index > 0 ifTrue:[
    2.72 -        forceTestCase := arguments at:index + 1.
    2.73 -        self logInfo:'set force test case: ', forceTestCase printString.
    2.74 +	forceTestCase := arguments at:index + 1.
    2.75 +	self logInfo:'run single test (forceTestCase): "%1"' with:forceTestCase.
    2.76      ].
    2.77  
    2.78 -    doRunSpecificUnitTests ifFalse:[
    2.79 -        self logInfo:'configured to run all available unit tests'.
    2.80 +    (doRunSpecificUnitTests not and:[forceTestCase isNil]) ifTrue:[
    2.81 +	self logInfo:'configured to run all available unit tests'.
    2.82      ].
    2.83  
    2.84 -    self logInfo:'collecting unit test classes to run'.
    2.85 +    "/ self logInfo:'collecting tests to run'.
    2.86      unitTestSuite := TestSuite named:unitTestSuiteName.
    2.87  
    2.88      (Smalltalk at: #'stx_goodies_regression') classNames do:[:eachClassName |
    2.89 -        (excludedUnitTestClassNames includes:eachClassName) ifTrue:[
    2.90 -            self
    2.91 -                logInfo:('excluded unit test class "%1".'
    2.92 -                    bindWith:eachClassName).
    2.93 -        ] ifFalse:[
    2.94 -            (corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
    2.95 -                self
    2.96 -                    logWarning:('RunUnitTest: unit test class is marked as corrupted, please fix #%1'
    2.97 -                        bindWith:eachClassName).
    2.98 -            ] ifFalse:[
    2.99 -                (eachClassName notNil
   2.100 -                and:[
   2.101 -                    "/ skip non test case classes
   2.102 -                    (#(
   2.103 -                        'stx_goodies_regression'
   2.104 -                    ) includes:eachClassName) not
   2.105 -                and:[
   2.106 -                    forceTestCase isNil
   2.107 -                    or:[forceTestCase = eachClassName
   2.108 -                    or:[forceTestCase = ((eachClassName subStrings:'::') lastIfEmpty:nil)]]
   2.109 -                ]]) ifTrue:[
   2.110 -                    eachClass := Smalltalk at:eachClassName.
   2.111 +	(excludedUnitTestClassNames includes:eachClassName) ifTrue:[
   2.112 +	    self logInfo:'exclude test "%1".' with:eachClassName.
   2.113 +	] ifFalse:[
   2.114 +	    (corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
   2.115 +		self logWarning:'test "%1" is marked as corrupted, please fix' with:eachClassName.
   2.116 +	    ] ifFalse:[
   2.117 +		(eachClassName notNil
   2.118 +		and:[
   2.119 +		    "/ skip non test class classes
   2.120 +		    (#(
   2.121 +			'stx_goodies_regression'
   2.122 +		    ) includes:eachClassName) not
   2.123 +		and:[
   2.124 +		    forceTestCase isNil
   2.125 +		    or:[forceTestCase = eachClassName
   2.126 +		    or:[forceTestCase = ((eachClassName subStrings:'::') lastIfEmpty:nil)]]
   2.127 +		]]) ifTrue:[
   2.128 +		    eachClass := Smalltalk at:eachClassName.
   2.129  
   2.130 -                    useCompiledUnitTestClasses ifFalse:[
   2.131 -                        "here we want test the jitter code
   2.132 -                         therfor we file in, exit if the class is already present somwhow"
   2.133 -                        eachClass notNil ifTrue:[
   2.134 -                            self
   2.135 -                                logWarning:('Unit test class "%1" was already present before file in.'
   2.136 -                                    bindWith:eachClassName).
   2.137 +		    useCompiledUnitTestClasses ifFalse:[
   2.138 +			"here we want to test the jitter code
   2.139 +			 therfore we file in, exit if the class is already present somwhow"
   2.140 +			eachClass notNil ifTrue:[
   2.141 +			    self logWarning:'test class "%1" was already present as stc-compiled class before file in.' with:eachClassName.
   2.142 +			    Smalltalk isSmalltalkDevelopmentSystem ifFalse:[
   2.143 +				Smalltalk exit:1.
   2.144 +			    ].
   2.145 +			].
   2.146  
   2.147 -                            Smalltalk exit:1.
   2.148 -                        ].
   2.149 +			eachClass := Smalltalk
   2.150 +			    fileInClass:eachClassName
   2.151 +			    package:'stx:goodies/regression'.
   2.152 +		    ].
   2.153  
   2.154 -                        eachClass := Smalltalk
   2.155 -                            fileInClass:eachClassName
   2.156 -                            package:'stx:goodies/regression'.
   2.157 -                    ].
   2.158 -
   2.159 -                    eachClass notNil ifTrue:[
   2.160 -                        (eachClass isTestCaseLike
   2.161 -                        and:[eachClass isAbstract not]) ifTrue:[
   2.162 -                            self
   2.163 -                                logInfo:('added unit test class "%1".'
   2.164 -                                    bindWith:eachClassName).
   2.165 -
   2.166 -                            unitTestSuite addTest:eachClass suite.
   2.167 -                        ] ifFalse:[
   2.168 -                            self
   2.169 -                                logInfo:('not a unit test class "%1" (class is abstract or something else).'
   2.170 -                                    bindWith:eachClassName).
   2.171 -                        ].
   2.172 -                    ] ifFalse:[
   2.173 -                        self
   2.174 -                            logWarning:('unit test class "%1" is not loaded.'
   2.175 -                                bindWith:eachClassName).
   2.176 -                    ].
   2.177 -                ] ifFalse:[
   2.178 -                    self
   2.179 -                        logInfo:('skipped unit test class "%1".'
   2.180 -                            bindWith:eachClassName).
   2.181 -                ].
   2.182 -            ].
   2.183 -        ].
   2.184 +		    eachClass notNil ifTrue:[
   2.185 +			(eachClass isTestCaseLike
   2.186 +			and:[eachClass isAbstract not]) ifTrue:[
   2.187 +			    self logInfo:'added test "%1".' with:eachClassName.
   2.188 +			    unitTestSuite addTest:eachClass suite.
   2.189 +			] ifFalse:[
   2.190 +			    self logInfo:'not a test "%1" (abstract or something else).'
   2.191 +				    with:eachClassName.
   2.192 +			].
   2.193 +		    ] ifFalse:[
   2.194 +			self logWarning:'test class "%1" is not loaded.' with:eachClassName.
   2.195 +		    ].
   2.196 +		] ifFalse:[
   2.197 +		    self logInfo:'skipped test "%1".' with:eachClassName.
   2.198 +		].
   2.199 +	    ].
   2.200 +	].
   2.201      ].
   2.202  
   2.203 -    self
   2.204 -        logInfo:('%1 unit test classes collected'
   2.205 -            bindWith:unitTestSuite tests size).
   2.206 +    self logInfo:'%1 unit test classes collected' with:unitTestSuite tests size.
   2.207  
   2.208      self logInfo:'start tests...'.
   2.209      result := unitTestSuite
   2.210 -        run:TestResultStX new
   2.211 -        beforeEachDo:[:test | self logInfo:'performing unit test ', test printString]
   2.212 -        afterEachDo:[:test| ]
   2.213 -        debug:debug.
   2.214 +	run:TestResultStX new
   2.215 +	beforeEachDo:[:test |
   2.216 +	    self logInfo:'performing unit test "%1"' with:test printString
   2.217 +	]
   2.218 +	afterEachDo:[:test :result|
   2.219 +	    |execTime status|
   2.220 +
   2.221 +	    execTime := result lastOutcome executionTimeDuration.
   2.222 +	    status := result lastOutcome overallOutcome.
   2.223 +	    self logInfo:'   Status: %1 (exec. Time: %2)' with:status with:execTime.
   2.224 +	]
   2.225 +	debug:debug.
   2.226  
   2.227      self logInfo:'tests finished.'.
   2.228 -    
   2.229 +
   2.230      self logInfo:'generating xml report...'.
   2.231 -    TestResultReporter
   2.232 -        report:result
   2.233 -        format:#xml_jUnit
   2.234 -        as:resultFilePathName ? 'testresult.xml'.
   2.235 +    [
   2.236 +	TestResultReporter
   2.237 +	    report:result
   2.238 +	    format:#xml_jUnit
   2.239 +	    as:(resultFilePathName ? 'testresult.xml').
   2.240 +    ] on:Error do:[:ex |
   2.241 +	self logWarning:'error while generating xml report: %1' with:ex description.
   2.242 +	self logWarning:'in: %1' with:(ex suspendedContext fullPrintAllString).
   2.243 +	Smalltalk isSmalltalkDevelopmentSystem ifFalse:[
   2.244 +	    Smalltalk exit:1.
   2.245 +	].
   2.246 +    ].
   2.247  
   2.248 -    self logInfo:('xml report in %1' bindWith:(resultFilePathName ? 'testresult.xml') asFilename pathName).
   2.249 +    self logInfo:'xml report generated in %1' with:(resultFilePathName ? 'testresult.xml') asFilename pathName.
   2.250  
   2.251      self logInfo:'Summary:'.
   2.252 -    self logInfo:('%1 tests' bindWith:result tests size).
   2.253 -    self logInfo:('%1 run' bindWith:result runCount).
   2.254 -    self logInfo:('%1 skipped' bindWith:result skippedCount).
   2.255 -    self logInfo:('%1 passed' bindWith:result passedCount).
   2.256 -    self logInfo:('%1 failed' bindWith:result failureCount).
   2.257 -    self logInfo:('%1 errors' bindWith:result errorCount).
   2.258 +    self logInfo:'  %1 tests' with:result tests size.
   2.259 +    self logInfo:'  %1 run' with:result runCount.
   2.260 +    self logInfo:'  %1 skipped' with:result skippedCount.
   2.261 +    self logInfo:'  %1 passed' with:result passedCount.
   2.262 +    self logInfo:'  %1 failed' with:result failureCount.
   2.263 +    self logInfo:'  %1 errors' with:result errorCount.
   2.264 +    self logInfo:'  exec. time: %1' with:(TimeDuration fromSeconds:result executionTime).
   2.265  
   2.266      "Modified (format): / 16-05-2018 / 13:59:47 / sr"
   2.267      "Modified: / 26-03-2019 / 19:00:38 / Claus Gittinger"
   2.268 @@ -268,64 +279,64 @@
   2.269  
   2.270  example2
   2.271      Processor activeProcess exceptionHandlerSet
   2.272 -        on:Class updateChangeFileQuerySignal
   2.273 -        do:[:ex | ex proceedWith:false].
   2.274 +	on:Class updateChangeFileQuerySignal
   2.275 +	do:[:ex | ex proceedWith:false].
   2.276  
   2.277      self
   2.278 -        runWithCompiledUnitTestClasses:true
   2.279 -        arguments:#(
   2.280 -            '--forceTestCase'
   2.281 -            'RegressionTests::ExternalStreamTest'
   2.282 -        )
   2.283 -        debug:true
   2.284 +	runWithCompiledUnitTestClasses:true
   2.285 +	arguments:#(
   2.286 +	    '--forceTestCase'
   2.287 +	    'RegressionTests::ExternalStreamTest'
   2.288 +	)
   2.289 +	debug:true
   2.290  
   2.291      "Created: / 26-03-2019 / 18:46:46 / Claus Gittinger"
   2.292  !
   2.293  
   2.294  example2b
   2.295      Processor activeProcess exceptionHandlerSet
   2.296 -        on:Class updateChangeFileQuerySignal
   2.297 -        do:[:ex | ex proceedWith:false].
   2.298 +	on:Class updateChangeFileQuerySignal
   2.299 +	do:[:ex | ex proceedWith:false].
   2.300  
   2.301      self
   2.302 -        runWithCompiledUnitTestClasses:true
   2.303 -        arguments:#(
   2.304 -            '--forceTestCase'
   2.305 -            'ExternalStreamTest'
   2.306 -        )
   2.307 -        debug:true
   2.308 +	runWithCompiledUnitTestClasses:true
   2.309 +	arguments:#(
   2.310 +	    '--forceTestCase'
   2.311 +	    'ExternalStreamTest'
   2.312 +	)
   2.313 +	debug:true
   2.314  
   2.315      "Created: / 26-03-2019 / 18:55:46 / Claus Gittinger"
   2.316  !
   2.317  
   2.318  example2c
   2.319      Processor activeProcess exceptionHandlerSet
   2.320 -        on:Class updateChangeFileQuerySignal
   2.321 -        do:[:ex | ex proceedWith:false].
   2.322 +	on:Class updateChangeFileQuerySignal
   2.323 +	do:[:ex | ex proceedWith:false].
   2.324  
   2.325      self
   2.326 -        runWithCompiledUnitTestClasses:true
   2.327 -        arguments:#(
   2.328 -            '--forceTestCase'
   2.329 -            'CRCTests'
   2.330 -        )
   2.331 -        debug:true
   2.332 +	runWithCompiledUnitTestClasses:true
   2.333 +	arguments:#(
   2.334 +	    '--forceTestCase'
   2.335 +	    'CRCTests'
   2.336 +	)
   2.337 +	debug:true
   2.338  
   2.339      "Created: / 26-03-2019 / 18:58:36 / Claus Gittinger"
   2.340  !
   2.341  
   2.342  example3
   2.343      Processor activeProcess exceptionHandlerSet
   2.344 -        on:Class updateChangeFileQuerySignal
   2.345 -        do:[:ex | ex proceedWith:false].
   2.346 +	on:Class updateChangeFileQuerySignal
   2.347 +	do:[:ex | ex proceedWith:false].
   2.348  
   2.349      self
   2.350 -        runWithCompiledUnitTestClasses:true
   2.351 -        arguments:#(
   2.352 -            '--run'
   2.353 -            'ExternalStreamTest'
   2.354 -        )
   2.355 -        debug:true
   2.356 +	runWithCompiledUnitTestClasses:true
   2.357 +	arguments:#(
   2.358 +	    '--run'
   2.359 +	    'ExternalStreamTest'
   2.360 +	)
   2.361 +	debug:true
   2.362  
   2.363      "Created: / 26-03-2019 / 18:51:42 / Claus Gittinger"
   2.364  ! !
   2.365 @@ -334,30 +345,34 @@
   2.366  
   2.367  log:aString type:aType
   2.368      Transcript notNil ifTrue:[
   2.369 -        Transcript showCR:'%1 [%2] : %3'
   2.370 -                with:Timestamp now printString
   2.371 -                with:(aType printString asLowercase paddedTo:'warning' size)
   2.372 -                with:aString.
   2.373 -        ^ self       
   2.374 -    ].    
   2.375 +	Transcript showCR:'%1 [%2] : %3'
   2.376 +		with:Timestamp now printString
   2.377 +		with:(aType printString asLowercase paddedTo:'warning' size)
   2.378 +		with:aString.
   2.379 +	^ self
   2.380 +    ].
   2.381      Stderr showCR:'%1 [%2] : %3'
   2.382 -            with:Timestamp now printString
   2.383 -            with:(aType printString asLowercase paddedTo:'warning' size)
   2.384 -            with:aString.
   2.385 +	    with:Timestamp now printString
   2.386 +	    with:(aType printString asLowercase paddedTo:'warning' size)
   2.387 +	    with:aString.
   2.388  
   2.389      "Modified: / 26-03-2019 / 18:53:48 / Claus Gittinger"
   2.390  !
   2.391  
   2.392  logInfo:aString
   2.393 -    self
   2.394 -	log:aString
   2.395 -	type:'INFO'
   2.396 +    self log:aString type:'INFO'
   2.397 +!
   2.398 +
   2.399 +logInfo:aString with:arg
   2.400 +    self log:(aString bindWith:arg) type:'INFO'
   2.401  !
   2.402  
   2.403  logWarning:aString
   2.404 -    self
   2.405 -	log:aString
   2.406 -	type:'WARNING'
   2.407 +    self log:aString type:'WARNING'
   2.408 +!
   2.409 +
   2.410 +logWarning:aString with:arg
   2.411 +    self log:(aString bindWith:arg) type:'WARNING'
   2.412  ! !
   2.413  
   2.414  !RunUnitTests class methodsFor:'documentation'!
   2.415 @@ -369,4 +384,3 @@
   2.416  version_CVS
   2.417      ^ '$Header$'
   2.418  ! !
   2.419 -