#BUGFIX by sr
authorsr
Wed, 16 May 2018 13:59:55 +0200
changeset 516f0cf7d35ee5f
parent 515 06436c1b24f6
child 517 2c7183682018
#BUGFIX by sr
class: RunUnitTests class
comment/format in: #runWithCompiledUnitTestClasses:arguments:debug:
quickSelfTest/RunUnitTests.st
     1.1 --- a/quickSelfTest/RunUnitTests.st	Fri May 11 16:42:39 2018 +0200
     1.2 +++ b/quickSelfTest/RunUnitTests.st	Wed May 16 13:59:55 2018 +0200
     1.3 @@ -50,7 +50,7 @@
     1.4      arguments:arguments
     1.5      debug:debug
     1.6  
     1.7 -    |doRunSpecificUnitTests unitTestSuiteName excludedUnitTestClassNames b
     1.8 +    |doRunSpecificUnitTests unitTestSuiteName excludedUnitTestClassNames corruptedUnitTestClassNames
     1.9       unitTestSuite
    1.10       eachClass
    1.11       result index
    1.12 @@ -63,127 +63,129 @@
    1.13  
    1.14      index := arguments indexOf:'--settingsFile'.
    1.15      index > 0 ifTrue:[
    1.16 -	settingsFilePathName := arguments at:index + 1.
    1.17 -	self logInfo:'load settings file: ', settingsFilePathName printString.
    1.18 -	settingsFilePathName asFilename fileIn.
    1.19 -	self logInfo:'ParserFlags makeCommand: ', ParserFlags makeCommand printString.
    1.20 +        settingsFilePathName := arguments at:index + 1.
    1.21 +        self logInfo:'load settings file: ', settingsFilePathName printString.
    1.22 +        settingsFilePathName asFilename fileIn.
    1.23 +        self logInfo:'ParserFlags makeCommand: ', ParserFlags makeCommand printString.
    1.24      ].
    1.25  
    1.26      (arguments includes:'--runOnlyExpeccoUnitTests') ifTrue:[
    1.27 -	self logInfo:'configured to run expecco unit tests only'.
    1.28 -	doRunSpecificUnitTests := true.
    1.29 -	unitTestSuiteName := 'expecco Unit Tests'.
    1.30 -	excludedUnitTestClassNames := self excludedUnitTestClassNamesForExpecco.
    1.31 +        self logInfo:'configured to run expecco unit tests only'.
    1.32 +        doRunSpecificUnitTests := true.
    1.33 +        unitTestSuiteName := 'expecco Unit Tests'.
    1.34 +        excludedUnitTestClassNames := self excludedUnitTestClassNamesForExpecco.
    1.35      ].
    1.36  
    1.37      index := arguments indexOf:'--resultFile'.
    1.38      index > 0 ifTrue:[
    1.39 -	resultFilePathName := arguments at:index + 1.
    1.40 -	self logInfo:'set custom result file: ', resultFilePathName printString.
    1.41 +        resultFilePathName := arguments at:index + 1.
    1.42 +        self logInfo:'set custom result file: ', resultFilePathName printString.
    1.43      ].
    1.44  
    1.45      index := arguments indexOf:'--forceTestCase'.
    1.46      index > 0 ifTrue:[
    1.47 -	forceTestCase := arguments at:index + 1.
    1.48 -	self logInfo:'set force test case: ', forceTestCase printString.
    1.49 +        forceTestCase := arguments at:index + 1.
    1.50 +        self logInfo:'set force test case: ', forceTestCase printString.
    1.51      ].
    1.52  
    1.53      doRunSpecificUnitTests ifFalse:[
    1.54 -	self logInfo:'configured to run all available unit tests'.
    1.55 +        self logInfo:'configured to run all available unit tests'.
    1.56      ].
    1.57  
    1.58      self logInfo:'collecting unit test classes to run'.
    1.59      unitTestSuite := TestSuite named:unitTestSuiteName.
    1.60  
    1.61      (Smalltalk at: #'stx_goodies_regression') classNames do:[:eachClassName |
    1.62 -	(excludedUnitTestClassNames includes:eachClassName) ifTrue:[
    1.63 -	    self
    1.64 -		logInfo:('excluded unit test class "%1".'
    1.65 -		    bindWith:eachClassName).
    1.66 -	] ifFalse:[
    1.67 -	    (corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
    1.68 -		self
    1.69 -		    logWarning:('RunUnitTest: unit test class is marked as corrupted, please fix #%1'
    1.70 -			bindWith:eachClassName).
    1.71 -	    ] ifFalse:[
    1.72 -		(eachClassName notNil
    1.73 -		and:[
    1.74 -		    "/ skip non test case classes
    1.75 -		    (#(
    1.76 -			'stx_goodies_regression'
    1.77 -		    ) includes:eachClassName) not
    1.78 -		and:[
    1.79 -		    forceTestCase isNil
    1.80 -		    or:[forceTestCase = eachClassName
    1.81 -		    or:[forceTestCase = ((eachClassName subStrings:'::') lastIfEmpty:nil)]]
    1.82 -		]]) ifTrue:[
    1.83 -		    eachClass := Smalltalk at:eachClassName.
    1.84 +        (excludedUnitTestClassNames includes:eachClassName) ifTrue:[
    1.85 +            self
    1.86 +                logInfo:('excluded unit test class "%1".'
    1.87 +                    bindWith:eachClassName).
    1.88 +        ] ifFalse:[
    1.89 +            (corruptedUnitTestClassNames includes:eachClassName) ifTrue:[
    1.90 +                self
    1.91 +                    logWarning:('RunUnitTest: unit test class is marked as corrupted, please fix #%1'
    1.92 +                        bindWith:eachClassName).
    1.93 +            ] ifFalse:[
    1.94 +                (eachClassName notNil
    1.95 +                and:[
    1.96 +                    "/ skip non test case classes
    1.97 +                    (#(
    1.98 +                        'stx_goodies_regression'
    1.99 +                    ) includes:eachClassName) not
   1.100 +                and:[
   1.101 +                    forceTestCase isNil
   1.102 +                    or:[forceTestCase = eachClassName
   1.103 +                    or:[forceTestCase = ((eachClassName subStrings:'::') lastIfEmpty:nil)]]
   1.104 +                ]]) ifTrue:[
   1.105 +                    eachClass := Smalltalk at:eachClassName.
   1.106  
   1.107 -		    useCompiledUnitTestClasses ifFalse:[
   1.108 -			"here we want test the jitter code
   1.109 -			 therfor we file in, exit if the class is already present somwhow"
   1.110 -			eachClass notNil ifTrue:[
   1.111 -			    self
   1.112 -				logWarning:('Unit test class "%1" was already present before file in.'
   1.113 -				    bindWith:eachClassName).
   1.114 +                    useCompiledUnitTestClasses ifFalse:[
   1.115 +                        "here we want test the jitter code
   1.116 +                         therfor we file in, exit if the class is already present somwhow"
   1.117 +                        eachClass notNil ifTrue:[
   1.118 +                            self
   1.119 +                                logWarning:('Unit test class "%1" was already present before file in.'
   1.120 +                                    bindWith:eachClassName).
   1.121  
   1.122 -			    Smalltalk exit:1.
   1.123 -			].
   1.124 +                            Smalltalk exit:1.
   1.125 +                        ].
   1.126  
   1.127 -			eachClass := Smalltalk
   1.128 -			    fileInClass:eachClassName
   1.129 -			    package:'stx:goodies/regression'.
   1.130 -		    ].
   1.131 +                        eachClass := Smalltalk
   1.132 +                            fileInClass:eachClassName
   1.133 +                            package:'stx:goodies/regression'.
   1.134 +                    ].
   1.135  
   1.136 -		    eachClass notNil ifTrue:[
   1.137 -			(eachClass isTestCaseLike
   1.138 -			and:[eachClass isAbstract not]) ifTrue:[
   1.139 -			    self
   1.140 -				logInfo:('added unit test class "%1".'
   1.141 -				    bindWith:eachClassName).
   1.142 +                    eachClass notNil ifTrue:[
   1.143 +                        (eachClass isTestCaseLike
   1.144 +                        and:[eachClass isAbstract not]) ifTrue:[
   1.145 +                            self
   1.146 +                                logInfo:('added unit test class "%1".'
   1.147 +                                    bindWith:eachClassName).
   1.148  
   1.149 -			    unitTestSuite addTest:eachClass suite.
   1.150 -			] ifFalse:[
   1.151 -			    self
   1.152 -				logInfo:('not a unit test class "%1" (class is abstract or something else).'
   1.153 -				    bindWith:eachClassName).
   1.154 -			].
   1.155 -		    ] ifFalse:[
   1.156 -			self
   1.157 -			    logWarning:('unit test class "%1" is not loaded.'
   1.158 -				bindWith:eachClassName).
   1.159 -		    ].
   1.160 -		] ifFalse:[
   1.161 -		    self
   1.162 -			logInfo:('skipped unit test class "%1".'
   1.163 -			    bindWith:eachClassName).
   1.164 -		].
   1.165 -	    ].
   1.166 -	].
   1.167 +                            unitTestSuite addTest:eachClass suite.
   1.168 +                        ] ifFalse:[
   1.169 +                            self
   1.170 +                                logInfo:('not a unit test class "%1" (class is abstract or something else).'
   1.171 +                                    bindWith:eachClassName).
   1.172 +                        ].
   1.173 +                    ] ifFalse:[
   1.174 +                        self
   1.175 +                            logWarning:('unit test class "%1" is not loaded.'
   1.176 +                                bindWith:eachClassName).
   1.177 +                    ].
   1.178 +                ] ifFalse:[
   1.179 +                    self
   1.180 +                        logInfo:('skipped unit test class "%1".'
   1.181 +                            bindWith:eachClassName).
   1.182 +                ].
   1.183 +            ].
   1.184 +        ].
   1.185      ].
   1.186  
   1.187      self
   1.188 -	logInfo:('%1 unit test classes collected'
   1.189 -	    bindWith:unitTestSuite tests size).
   1.190 +        logInfo:('%1 unit test classes collected'
   1.191 +            bindWith:unitTestSuite tests size).
   1.192  
   1.193      self logInfo:'starting unit tests'.
   1.194      result := unitTestSuite
   1.195 -	run:TestResultStX new
   1.196 -	beforeEachDo:[:test | self logInfo:'performing unit test ', test printString]
   1.197 -	afterEachDo:[:test| ]
   1.198 -	debug:debug.
   1.199 +        run:TestResultStX new
   1.200 +        beforeEachDo:[:test | self logInfo:'performing unit test ', test printString]
   1.201 +        afterEachDo:[:test| ]
   1.202 +        debug:debug.
   1.203  
   1.204      self logInfo:'generating report'.
   1.205      TestResultReporter
   1.206 -	report:result
   1.207 -	format:#xml_jUnit
   1.208 -	as:resultFilePathName ? 'testresult.xml'.
   1.209 +        report:result
   1.210 +        format:#xml_jUnit
   1.211 +        as:resultFilePathName ? 'testresult.xml'.
   1.212  
   1.213      self logInfo:'summary:'.
   1.214      self logInfo:('%1 tests' bindWith:result runCount).
   1.215      self logInfo:('%1 passed' bindWith:result passedCount).
   1.216      self logInfo:('%1 failed' bindWith:result failureCount).
   1.217      self logInfo:('%1 errors' bindWith:result errorCount).
   1.218 +
   1.219 +    "Modified (format): / 16-05-2018 / 13:59:47 / sr"
   1.220  ! !
   1.221  
   1.222  !RunUnitTests class methodsFor:'constants'!
   1.223 @@ -277,3 +279,4 @@
   1.224  version_CVS
   1.225      ^ '$Header$'
   1.226  ! !
   1.227 +