class: TestCase expecco_2_6_0 expecco_2_6_0_45_windows_final expecco_2_6_0_49_windows_final expecco_2_6_0rc1 expecco_2_6_1 expecco_2_6_2
authorClaus Gittinger <cg@exept.de>
Sun, 28 Apr 2013 15:41:55 +0200
changeset 578 be4d2b6894b9
parent 577 3dea1e941af7
child 579 fb932a5daa97
class: TestCase changed: #iconInBrowserSymbol #lastTestRunResultOrNil
TestCase.st
--- a/TestCase.st	Tue Apr 23 12:33:43 2013 +0200
+++ b/TestCase.st	Sun Apr 28 15:41:55 2013 +0200
@@ -128,18 +128,30 @@
 !
 
 lastTestRunResultOrNil
+    "Returns a state (TestResult stateXXX), depending
+     on the state of the tests:
+        statePass if all tests passed,
+        stateError if any error,
+        stateFail if any fail,
+     or nil if never run            
+    "
 
-    "Returns true if all tests passed, false if at least
-     one failed/error  or nil if never run            
-    "
+    |anyFail|
+
     lastOutcomes isNil ifTrue:[^nil].
     lastOutcomes size ~= self testSelectors size ifTrue:[^nil].
+    anyFail := false.
+
     lastOutcomes do:[:outcome|
-        outcome result == (TestResult statePass) ifFalse:[
-            ^false
+        outcome result == (TestResult stateError) ifTrue:[
+            ^ TestResult stateError
+        ].
+        outcome result == (TestResult stateFail) ifTrue:[
+            anyFail := true
         ].
     ].
-    ^true
+    anyFail ifTrue:[ ^ TestResult stateFail ].
+    ^ TestResult statePass
 
     "Modified: / 20-08-2011 / 14:59:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
@@ -295,11 +307,16 @@
     self theNonMetaclass isAbstract ifTrue:[^ super iconInBrowserSymbol].
 
     lastResult := self lastTestRunResultOrNil.
-    lastResult == true ifTrue:[
-        ^ #testCasePassedIcon
-    ].
-    lastResult == false ifTrue:[
-        ^ #testCaseFailedIcon
+    lastResult notNil ifTrue:[
+        lastResult == TestResult statePass ifTrue:[
+            ^ #testCasePassedIcon
+        ].
+        lastResult == TestResult stateFail ifTrue:[
+            ^ #testCaseFailedIcon
+        ].
+        lastResult == TestResult stateError ifTrue:[
+            ^ #testCaseErrorIcon
+        ].
     ].
     ^ #testCaseClassIcon
 ! !
@@ -915,11 +932,11 @@
 !TestCase class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.101 2013-04-23 10:33:23 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.102 2013-04-28 13:41:55 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.101 2013-04-23 10:33:23 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.102 2013-04-28 13:41:55 cg Exp $'
 !
 
 version_SVN