class: TestCase
authorStefan Vogel <sv@exept.de>
Tue, 23 Apr 2013 12:33:23 +0200
changeset 576 55ef6aaf19cb
parent 575 f55a221af068
child 577 3dea1e941af7
class: TestCase added: #safeTearDown changed: #runCase #runCaseAsFailure Take care of AbortOperationRequest being raised in Debugger in tearDown after an errornous test case.
TestCase.st
--- a/TestCase.st	Fri Apr 19 18:00:25 2013 +0200
+++ b/TestCase.st	Tue Apr 23 12:33:23 2013 +0200
@@ -598,6 +598,14 @@
     self perform: testSelector sunitAsSymbol
 !
 
+safeTearDown
+    "Have to handle Abort. When tearDown is called as inside an ensure block after
+     an abort in the debugger of an errornous test case and raises an error with a debugger
+     itself."
+
+    AbortOperationRequest handle:[:ex| ] do:[self tearDown].
+!
+
 setTestSelector: aSymbol
         testSelector := aSymbol
 !
@@ -865,7 +873,7 @@
         didSetup := true.
         self performTest.
     ] sunitEnsure: [
-        didSetup ifTrue:[ self tearDown ]
+        didSetup ifTrue:[ self safeTearDown ]
     ]
 
     "Modified (comment): / 18-08-2011 / 20:35:20 / cg"
@@ -874,7 +882,7 @@
 runCaseAsFailure
     self setUp.
     [
-        [self openDebuggerOnFailingTestMethod] ensure: [self tearDown]
+        [self openDebuggerOnFailingTestMethod] ensure: [self safeTearDown]
     ] fork
 
     "Modified: / 21.6.2000 / 10:04:33 / Sames"
@@ -907,11 +915,11 @@
 !TestCase class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.100 2013-04-19 16:00:25 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.101 2013-04-23 10:33:23 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.100 2013-04-19 16:00:25 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.101 2013-04-23 10:33:23 stefan Exp $'
 !
 
 version_SVN