--- a/quickSelfTest/RunUnitTests.st Thu Mar 28 14:39:52 2019 +0100
+++ b/quickSelfTest/RunUnitTests.st Thu Mar 28 15:25:46 2019 +0100
@@ -11,6 +11,39 @@
category:'tests-Regression'
!
+TestCase subclass:#RunnerSelfTest
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:RunUnitTests
+!
+
+!RunUnitTests::RunnerSelfTest methodsFor:'tests'!
+
+test01_shouldPass
+ self assert:true.
+!
+
+test02_shouldFail
+ self assert:false.
+!
+
+test03_shouldError
+ |zero|
+ zero := 0.
+ self assert:(10 / zero).
+!
+
+test04_shouldError
+ self assert:(10 foo).
+!
+
+test05_shouldBeSkipped
+ self skip:'this is skipped'.
+ self assert:(10 foo).
+! !
+
+
!RunUnitTests class methodsFor:'documentation'!
documentation
@@ -51,6 +84,7 @@
debug:debug
|arguments
+ possibleClassNames
doRunSpecificUnitTests unitTestSuiteName excludedUnitTestClassNames corruptedUnitTestClassNames
unitTestSuite
eachClass
@@ -110,6 +144,13 @@
self logInfo:'run single test (forceTestCase): "%1"' with:forceTestCase.
].
+ index := arguments indexOf:'--testRunner'.
+ index > 0 ifTrue:[
+ arguments removeIndex:index.
+ forceTestCase := #'RunUnitTests::RunnerSelfTest'.
+ self logInfo:'execute runner self test'.
+ ].
+
(doRunSpecificUnitTests not and:[forceTestCase isNil]) ifTrue:[
self logInfo:'configured to run all available unit tests'.
].
@@ -117,7 +158,10 @@
"/ self logInfo:'collecting tests to run'.
unitTestSuite := TestSuite named:unitTestSuiteName.
- (Smalltalk at: #'stx_goodies_regression') classNames do:[:eachClassName |
+ possibleClassNames := (Smalltalk at: #'stx_goodies_regression') classNames.
+ possibleClassNames add:#'RunUnitTests::RunnerSelfTest'.
+
+ possibleClassNames do:[:eachClassName |
(excludedUnitTestClassNames includes:eachClassName) ifTrue:[
self logInfo:'exclude test "%1".' with:eachClassName.
] ifFalse:[
@@ -175,7 +219,7 @@
].
].
- self logInfo:'%1 unit test classes collected' with:unitTestSuite tests size.
+ self logInfo:'%1 unit test(s) collected' with:(unitTestSuite tests size).
self logInfo:'start tests...'.
result := unitTestSuite
@@ -188,7 +232,10 @@
execTime := result lastOutcome executionTimeDuration.
status := result lastOutcome result.
- self logInfo:' Status: %1 (exec. Time: %2)' with:status with:execTime.
+ self logInfo:' %1 (%2)' with:status with:execTime.
+ (status == TestResult stateFail or:[status == TestResult stateError]) ifTrue:[
+ self logInfo:' ==================='.
+ ]
]
debug:debug.
@@ -211,12 +258,13 @@
self logInfo:'xml report generated in %1' with:(resultFilePathName ? 'testresult.xml') asFilename pathName.
self logInfo:'Summary:'.
- self logInfo:' %1 tests' with:result tests size.
- self logInfo:' %1 run' with:result runCount.
- self logInfo:' %1 skipped' with:result skippedCount.
- self logInfo:' %1 passed' with:result passedCount.
- self logInfo:' %1 failed' with:result failureCount.
- self logInfo:' %1 errors' with:result errorCount.
+ self logInfo:(' %1 tests, %2 run (%3 skipped) / %4 passed, %5 failed, %6 errors'
+ bindWith:result tests size
+ with:result runCount
+ with:result skippedCount
+ with:result passedCount
+ with:result failureCount
+ with:result errorCount).
"/ self logInfo:' exec. time: %1' with:(TimeDuration fromSeconds:result executionTime).
"Modified (format): / 16-05-2018 / 13:59:47 / sr"