*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Thu, 28 Mar 2019 15:25:46 +0100
changeset 54954b9fecb0bc9
parent 548 8846155dc785
child 550 57af1d2ef11e
*** empty log message ***
quickSelfTest/RunUnitTests.st
quickSelfTest/RunUnitTestsStart.st
     1.1 --- a/quickSelfTest/RunUnitTests.st	Thu Mar 28 14:39:52 2019 +0100
     1.2 +++ b/quickSelfTest/RunUnitTests.st	Thu Mar 28 15:25:46 2019 +0100
     1.3 @@ -11,6 +11,39 @@
     1.4  	category:'tests-Regression'
     1.5  !
     1.6  
     1.7 +TestCase subclass:#RunnerSelfTest
     1.8 +	instanceVariableNames:''
     1.9 +	classVariableNames:''
    1.10 +	poolDictionaries:''
    1.11 +	privateIn:RunUnitTests
    1.12 +!
    1.13 +
    1.14 +!RunUnitTests::RunnerSelfTest methodsFor:'tests'!
    1.15 +
    1.16 +test01_shouldPass
    1.17 +    self assert:true.
    1.18 +!
    1.19 +
    1.20 +test02_shouldFail
    1.21 +    self assert:false.
    1.22 +!
    1.23 +
    1.24 +test03_shouldError
    1.25 +    |zero|
    1.26 +    zero := 0.
    1.27 +    self assert:(10 / zero).
    1.28 +!
    1.29 +
    1.30 +test04_shouldError
    1.31 +    self assert:(10 foo).
    1.32 +!
    1.33 +
    1.34 +test05_shouldBeSkipped
    1.35 +    self skip:'this is skipped'.
    1.36 +    self assert:(10 foo).
    1.37 +! !
    1.38 +
    1.39 +
    1.40  !RunUnitTests class methodsFor:'documentation'!
    1.41  
    1.42  documentation
    1.43 @@ -51,6 +84,7 @@
    1.44      debug:debug
    1.45  
    1.46      |arguments
    1.47 +     possibleClassNames
    1.48       doRunSpecificUnitTests unitTestSuiteName excludedUnitTestClassNames corruptedUnitTestClassNames
    1.49       unitTestSuite
    1.50       eachClass
    1.51 @@ -110,6 +144,13 @@
    1.52  	self logInfo:'run single test (forceTestCase): "%1"' with:forceTestCase.
    1.53      ].
    1.54  
    1.55 +    index := arguments indexOf:'--testRunner'.
    1.56 +    index > 0 ifTrue:[
    1.57 +	arguments removeIndex:index.
    1.58 +	forceTestCase := #'RunUnitTests::RunnerSelfTest'.
    1.59 +	self logInfo:'execute runner self test'.
    1.60 +    ].
    1.61 +
    1.62      (doRunSpecificUnitTests not and:[forceTestCase isNil]) ifTrue:[
    1.63  	self logInfo:'configured to run all available unit tests'.
    1.64      ].
    1.65 @@ -117,7 +158,10 @@
    1.66      "/ self logInfo:'collecting tests to run'.
    1.67      unitTestSuite := TestSuite named:unitTestSuiteName.
    1.68  
    1.69 -    (Smalltalk at: #'stx_goodies_regression') classNames do:[:eachClassName |
    1.70 +    possibleClassNames := (Smalltalk at: #'stx_goodies_regression') classNames.
    1.71 +    possibleClassNames add:#'RunUnitTests::RunnerSelfTest'.
    1.72 +
    1.73 +    possibleClassNames do:[:eachClassName |
    1.74  	(excludedUnitTestClassNames includes:eachClassName) ifTrue:[
    1.75  	    self logInfo:'exclude test "%1".' with:eachClassName.
    1.76  	] ifFalse:[
    1.77 @@ -175,7 +219,7 @@
    1.78  	].
    1.79      ].
    1.80  
    1.81 -    self logInfo:'%1 unit test classes collected' with:unitTestSuite tests size.
    1.82 +    self logInfo:'%1 unit test(s) collected' with:(unitTestSuite tests size).
    1.83  
    1.84      self logInfo:'start tests...'.
    1.85      result := unitTestSuite
    1.86 @@ -188,7 +232,10 @@
    1.87  
    1.88  	    execTime := result lastOutcome executionTimeDuration.
    1.89  	    status := result lastOutcome result.
    1.90 -	    self logInfo:'   Status: %1 (exec. Time: %2)' with:status with:execTime.
    1.91 +	    self logInfo:'   %1 (%2)' with:status with:execTime.
    1.92 +	    (status == TestResult stateFail or:[status == TestResult stateError]) ifTrue:[
    1.93 +		self logInfo:'   ==================='.
    1.94 +	    ]
    1.95  	]
    1.96  	debug:debug.
    1.97  
    1.98 @@ -211,12 +258,13 @@
    1.99      self logInfo:'xml report generated in %1' with:(resultFilePathName ? 'testresult.xml') asFilename pathName.
   1.100  
   1.101      self logInfo:'Summary:'.
   1.102 -    self logInfo:'  %1 tests' with:result tests size.
   1.103 -    self logInfo:'  %1 run' with:result runCount.
   1.104 -    self logInfo:'  %1 skipped' with:result skippedCount.
   1.105 -    self logInfo:'  %1 passed' with:result passedCount.
   1.106 -    self logInfo:'  %1 failed' with:result failureCount.
   1.107 -    self logInfo:'  %1 errors' with:result errorCount.
   1.108 +    self logInfo:('  %1 tests, %2 run (%3 skipped) / %4 passed, %5 failed, %6 errors'
   1.109 +		bindWith:result tests size
   1.110 +		with:result runCount
   1.111 +		with:result skippedCount
   1.112 +		with:result passedCount
   1.113 +		with:result failureCount
   1.114 +		with:result errorCount).
   1.115      "/ self logInfo:'  exec. time: %1' with:(TimeDuration fromSeconds:result executionTime).
   1.116  
   1.117      "Modified (format): / 16-05-2018 / 13:59:47 / sr"
     2.1 --- a/quickSelfTest/RunUnitTestsStart.st	Thu Mar 28 14:39:52 2019 +0100
     2.2 +++ b/quickSelfTest/RunUnitTestsStart.st	Thu Mar 28 15:25:46 2019 +0100
     2.3 @@ -63,6 +63,7 @@
     2.4      Stderr nextPutLine:'  --forceTestCase testName .........class name of a test case (only this test case will be executed)'.
     2.5      Stderr nextPutLine:'  --run testName ...................same, shorter'.
     2.6      Stderr nextPutLine:'  --skip testName ..................skip a test class'.
     2.7 +    Stderr nextPutLine:'  --testRunner .....................test the runner itself (please check the generated xml)'.
     2.8  
     2.9      "Modified: / 26-03-2019 / 18:47:53 / Claus Gittinger"
    2.10  ! !