VMCrashTestCase: Added support for test skipping jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sat, 03 Sep 2016 08:01:04 +0100
branchjv
changeset 1530 b21a5e9a6c26
parent 1510 6fb7e9d33c4d
child 1531 dbd517ea6e1c
VMCrashTestCase: Added support for test skipping ...i.e, `self skipIf: condition description: 'Does not work yet'`
RegressionTests__VMCrashTestCase.st
--- a/RegressionTests__VMCrashTestCase.st	Wed Jul 13 00:31:45 2016 +0100
+++ b/RegressionTests__VMCrashTestCase.st	Sat Sep 03 08:01:04 2016 +0100
@@ -4,7 +4,8 @@
 
 TestCase subclass:#VMCrashTestCase
 	instanceVariableNames:''
-	classVariableNames:'EXIT_CODE_SUCCESS EXIT_CODE_FAILURE EXIT_CODE_ERROR'
+	classVariableNames:'EXIT_CODE_SUCCESS EXIT_CODE_FAILURE EXIT_CODE_ERROR
+		EXIT_CODE_SKIPPED'
 	poolDictionaries:''
 	category:'tests-Regression-Abstract'
 !
@@ -48,8 +49,9 @@
     EXIT_CODE_SUCCESS := 0.
     EXIT_CODE_FAILURE := 1.
     EXIT_CODE_ERROR := 2.
+    EXIT_CODE_SKIPPED := 3.
 
-    "Modified: / 05-09-2014 / 18:17:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-09-2016 / 08:23:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !VMCrashTestCase class methodsFor:'testing'!
@@ -160,26 +162,30 @@
 
         blocker wait.
         status code == EXIT_CODE_SUCCESS ifFalse:[ 
-            status code == EXIT_CODE_FAILURE ifTrue:[
-                (outputFile notNil and:[ outputFile exists ]) ifTrue:[
-                    Stdout nextPutAll: '== TEST FAILED: '; nextPutAll: testSelector; nextPutLine:' =='.
-                    outputFile readingFileDo:[:s|
-                        [ s atEnd ] whileFalse:[
-                            Stdout nextPutLine: s nextLine.
+            status code == EXIT_CODE_SKIPPED ifTrue:[ 
+                self skipIf: true description: 'Skipped'.
+            ] ifFalse:[ 
+                status code == EXIT_CODE_FAILURE ifTrue:[
+                    (outputFile notNil and:[ outputFile exists ]) ifTrue:[
+                        Stdout nextPutAll: '== TEST FAILED: '; nextPutAll: testSelector; nextPutLine:' =='.
+                        outputFile readingFileDo:[:s|
+                            [ s atEnd ] whileFalse:[
+                                Stdout nextPutLine: s nextLine.
+                            ].
                         ].
                     ].
-                ].
-                self assert: false description: 'Assertion failed, see log'.
-            ] ifFalse:[
-                (outputFile notNil and:[ outputFile exists ]) ifTrue:[
-                    Stdout nextPutAll: '== TEST ERROR: '; nextPutAll: testSelector; nextPutLine:' =='.
-                    outputFile readingFileDo:[:s|
-                        [ s atEnd ] whileFalse:[
-                            Stdout nextPutLine: s nextLine.
+                    self assert: false description: 'Assertion failed, see log'.
+                ] ifFalse:[
+                    (outputFile notNil and:[ outputFile exists ]) ifTrue:[
+                        Stdout nextPutAll: '== TEST ERROR: '; nextPutAll: testSelector; nextPutLine:' =='.
+                        outputFile readingFileDo:[:s|
+                            [ s atEnd ] whileFalse:[
+                                Stdout nextPutLine: s nextLine.
+                            ].
                         ].
                     ].
+                    self error: 'Error occured'.
                 ].
-                self error: 'Error occured'.
             ].
         ].
     ] ensure:[
@@ -199,27 +205,34 @@
     "
 
     "Created: / 04-09-2014 / 18:13:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 19-09-2014 / 16:43:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 07-07-2016 / 10:53:30 / jv"
+    "Modified: / 03-09-2016 / 07:56:21 / jv"
+    "Modified (format): / 03-09-2016 / 08:22:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 runCaseInternal
     [
-	super runCase.
-	Stdout cr;
-	    nextPutAll: 'PASSED'; cr.
+        [     
+        super runCase.
+        Stdout cr;
+            nextPutAll: 'PASSED'; cr.
+        ] on: TestResult skipped do:[:skip| 
+             Stdout cr;
+                nextPutAll: 'SKIPPED'; cr.
+            Smalltalk exit: EXIT_CODE_SKIPPED.
+        ]
     ] on: TestResult failure do:[:failure |
-	Stdout cr;
-	    nextPutAll: 'FAILURE: '; nextPutAll: failure description; cr.
-	Smalltalk exit: EXIT_CODE_FAILURE.
+        Stdout cr;
+            nextPutAll: 'FAILURE: '; nextPutAll: failure description; cr.
+        Smalltalk exit: EXIT_CODE_FAILURE.
     ] on: TestResult exError do:[:error |
-	Stdout cr;
-	    nextPutAll: 'ERROR: '; nextPutAll: error description; cr.
-	Smalltalk exit: EXIT_CODE_ERROR.
+        Stdout cr;
+            nextPutAll: 'ERROR: '; nextPutAll: error description; cr.
+        Smalltalk exit: EXIT_CODE_ERROR.
     ].
 
     "Created: / 04-09-2014 / 17:41:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 05-09-2014 / 18:37:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-09-2016 / 07:53:15 / jv"
 ! !
 
 !VMCrashTestCase methodsFor:'tests - infrastructure'!
@@ -236,16 +249,25 @@
     self assert: result passedCount = 1.
     self assert: result failureCount = 0.
     self assert: result errorCount = 0.
+    self assert: result skippedCount = 0.
 
     result := self class run: #tst_fail.
     self assert: result passedCount = 0.
     self assert: result failureCount = 1.
     self assert: result errorCount = 0.
+    self assert: result skippedCount = 0.
 
     result := self class run: #tst_error.
     self assert: result passedCount = 0.
     self assert: result failureCount = 0.
     self assert: result errorCount = 1.
+    self assert: result skippedCount = 0.
+
+    result := self class run: #tst_skip.
+    self assert: result passedCount = 0.
+    self assert: result failureCount = 0.
+    self assert: result errorCount = 0.
+    self assert: result skippedCount = 1.     
 
     "
     VMCrashTestCase run: #tst_crash.
@@ -254,9 +276,11 @@
     self assert: result passedCount = 0.
     self assert: result failureCount = 0.
     self assert: result errorCount = 1.
+    self assert: result skippedCount = 0.
 
     "Created: / 05-09-2014 / 18:22:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 08-09-2014 / 12:26:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-09-2016 / 07:44:57 / jv"
 !
 
 tst_crash
@@ -295,6 +319,13 @@
 
     "Created: / 05-09-2014 / 18:20:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 08-09-2014 / 12:26:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+tst_skip
+    <spawn: true>
+    self skipIf: true description: 'Skip the test to test skipping'
+
+    "Created: / 03-09-2016 / 07:42:55 / jv"
 ! !
 
 !VMCrashTestCase class methodsFor:'documentation'!