*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Thu, 18 Aug 2005 13:44:32 +0200
changeset 122 61e456491017
parent 121 491b0f280eb9
child 123 5fb90858d4e6
*** empty log message ***
TestCase.st
TestRunner.st
TestSuite.st
--- a/TestCase.st	Wed Mar 16 17:52:46 2005 +0100
+++ b/TestCase.st	Thu Aug 18 13:44:32 2005 +0200
@@ -427,6 +427,10 @@
         aStream nextPutAll: self name.
         aStream nextPutAll: '>>'.
         testSelector printOn: aStream
+!
+
+testName
+        ^ testSelector.
 ! !
 
 !TestCase methodsFor:'private'!
@@ -486,6 +490,16 @@
     ].
 ! !
 
+!TestCase methodsFor:'queries'!
+
+isTestCase
+    ^ true
+!
+
+isTestSuite
+    ^ false
+! !
+
 !TestCase methodsFor:'running'!
 
 debug
@@ -570,7 +584,12 @@
 
 run: aResult beforeEachDo:block1 afterEachDo:block2
         block1 value:self value:aResult.
-"/testSelector == #testReadStatement ifTrue:[self halt].
+        aResult runCase: self.
+        block2 value:self value:aResult.
+!
+
+run: aResult beforeEachTestCaseDo:block1 afterEachTestCaseDo:block2
+        block1 value:self value:aResult.
         aResult runCase: self.
         block2 value:self value:aResult.
 !
@@ -606,7 +625,7 @@
 !TestCase class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.37 2004-09-02 08:30:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.38 2005-08-18 11:44:20 cg Exp $'
 ! !
 
 TestCase initialize!
--- a/TestRunner.st	Wed Mar 16 17:52:46 2005 +0100
+++ b/TestRunner.st	Thu Aug 18 13:44:32 2005 +0200
@@ -621,28 +621,19 @@
                     failureCountBefore := result failureCount.
 
                     [
+                        |caseName|
+
                         aTestSuite 
                             run:result 
-                            beforeEachDo:[:eachCaseOrSuite :eachResult |  
-                                |caseName passed errorCountAfter failureCountAfter|
-
-                                (eachCaseOrSuite isKindOf:TestCase) ifTrue:[
-                                    caseName := eachCaseOrSuite selector.
-                                ] ifFalse:[
-                                    caseName := eachCaseOrSuite name.
-                                ].
+                            beforeEachDo:[:eachCase :eachResult |  
+                                caseName := eachCase testName.
                                 caseName size == 0 ifTrue:[self halt].
 
                                 self displayDetails:(caseName , '...').
-
                                 self testPassed:caseName
                             ]
-                            afterEachDo:[:eachCaseOrSuite :eachResult |  
-                                |caseName passed errorCountAfter failureCountAfter|
-
-                                caseName := eachCaseOrSuite name.
-                                caseName size == 0 ifTrue:[self halt].
-                                "/ self displayDetails:('...').
+                            afterEachDo:[:eachCase :eachResult |  
+                                |passed errorCountAfter failureCountAfter|
 
                                 errorCountAfter := result errorCount.
                                 failureCountAfter := result failureCount.
@@ -1115,5 +1106,5 @@
 !TestRunner class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestRunner.st,v 1.55 2005-03-16 16:52:46 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestRunner.st,v 1.56 2005-08-18 11:44:32 cg Exp $'
 ! !
--- a/TestSuite.st	Wed Mar 16 17:52:46 2005 +0100
+++ b/TestSuite.st	Thu Aug 18 13:44:32 2005 +0200
@@ -65,6 +65,10 @@
 			
 !
 
+testName
+        ^ self name
+!
+
 tests
 	tests isNil ifTrue: [tests := OrderedCollection new].
 	^tests
@@ -83,6 +87,16 @@
         self tests do: [ :each | each removeDependentFromHierachy: anObject]
 ! !
 
+!TestSuite methodsFor:'queries'!
+
+isTestCase
+    ^ false
+!
+
+isTestSuite
+    ^ true
+! !
+
 !TestSuite methodsFor:'running'!
 
 run
@@ -105,8 +119,8 @@
         self tests do: 
                 [:each | 
                 self changed: each.
-                each run: aResult.
-                block2 value:each value:aResult
+                each run: aResult afterEachDo:block2.
+"/                block2 value:each value:aResult
                 ]
 
     "Modified: / 21.6.2000 / 10:14:01 / Sames"
@@ -121,6 +135,14 @@
                 "/ each run: aResult.
                 block2 value:each value:aResult.
                 ]
+!
+
+run: aResult beforeEachTestCaseDo:block1 afterEachTestCaseDo:block2
+        self tests do: 
+                [:each | 
+                self changed: each.
+                each run: aResult beforeEachTestCaseDo:block1 afterEachTestCaseDo:block2.
+                ]
 ! !
 
 !TestSuite methodsFor:'testing'!
@@ -143,5 +165,5 @@
 !TestSuite class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestSuite.st,v 1.13 2003-09-26 15:53:45 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestSuite.st,v 1.14 2005-08-18 11:44:14 cg Exp $'
 ! !