#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Thu, 28 Mar 2019 12:17:57 +0100
changeset 738 19f75695aa0f
parent 737 a4f9d8da94aa
child 739 8af22adf78e4
#FEATURE by cg class: TestResult class definition added: #lastOutcome changed: #runCase:debugged: class: TestResult class added: #stateInconclusive #stateNames comment/format in: #stateError #stateSkip
TestResult.st
--- a/TestResult.st	Thu Mar 28 12:17:18 2019 +0100
+++ b/TestResult.st	Thu Mar 28 12:17:57 2019 +0100
@@ -1,11 +1,9 @@
-"{ Encoding: utf8 }"
-
 "{ Package: 'stx:goodies/sunit' }"
 
 "{ NameSpace: Smalltalk }"
 
 Object subclass:#TestResult
-	instanceVariableNames:'name timestamp failures errors passed skipped outcome'
+	instanceVariableNames:'name timestamp failures errors passed skipped outcome lastOutcome'
 	classVariableNames:'DefaultClass'
 	poolDictionaries:''
 	category:'SUnit-Base'
@@ -61,7 +59,11 @@
 !TestResult class methodsFor:'constants'!
 
 stateError
+    "this symbol used to freak around everywhere in the code"
+
     ^ #error
+
+    "Modified (comment): / 28-03-2019 / 11:26:52 / Claus Gittinger"
 !
 
 stateFail
@@ -71,6 +73,27 @@
     ^ #fail
 !
 
+stateInconclusive
+    "this symbol is currently not used;
+     support will be added soon."
+
+    ^ #inconclusive
+
+    "Created: / 28-03-2019 / 11:28:32 / Claus Gittinger"
+!
+
+stateNames
+    ^ { 
+        self statePass.
+        self stateError.
+        self stateFail.
+        self stateSkip.
+        self stateInconclusive.
+     }
+
+    "Created: / 28-03-2019 / 11:27:55 / Claus Gittinger"
+!
+
 statePass
     "this symbol used to freak around everywhere in the code;
      and I was never sure if #pass or #passed is to be used."
@@ -79,7 +102,12 @@
 !
 
 stateSkip
+    "this symbol used to freak around everywhere in the code;
+     and I was never sure if #skip or #skipped is to be used."
+
     ^ #skip
+
+    "Modified (comment): / 28-03-2019 / 11:27:07 / Claus Gittinger"
 ! !
 
 !TestResult class methodsFor:'exceptions'!
@@ -422,6 +450,15 @@
     "Created: / 16-08-2011 / 17:14:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+lastOutcome
+    "the outcome of the last executed case
+     (only valid in the run...after:[] block)"
+    
+    ^ lastOutcome.
+
+    "Created: / 28-03-2019 / 11:21:21 / Claus Gittinger"
+!
+
 rememberEndTime
     "remembers the endTime of the current test (in outcome)"
 
@@ -506,6 +543,7 @@
             (outcome result == TestResult stateSkip) ifFalse:[
                 self addPass:aTestCase.
             ].    
+            lastOutcome := outcome.
             outcome := nil.
         ] sunitOn:self exceptions do: [:ex |
             self rememberEndTime.
@@ -534,7 +572,7 @@
     "Created: / 21-08-2011 / 17:48:19 / cg"
     "Modified: / 04-06-2012 / 18:50:15 / cg"
     "Modified: / 14-01-2013 / 13:28:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 23-03-2019 / 10:35:41 / Claus Gittinger"
+    "Modified: / 28-03-2019 / 11:24:26 / Claus Gittinger"
 ! !
 
 !TestResult methodsFor:'testing'!