initial checkin
authorClaus Gittinger <cg@exept.de>
Thu, 13 Dec 2001 22:25:37 +0100
changeset 44 63d3c94197da
parent 43 d46c62bd3c4e
child 45 bdcfbc26b880
initial checkin
TestResource.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TestResource.st	Thu Dec 13 22:25:37 2001 +0100
@@ -0,0 +1,116 @@
+"{ Package: 'stx:goodies/sunit' }"
+
+Object subclass:#TestResource
+	instanceVariableNames:'name description'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'SUnit-Base'
+!
+
+TestResource class instanceVariableNames:'current'
+
+"
+ No other class instance variables are inherited by this class.
+"
+!
+
+
+!TestResource class methodsFor:'Accessing'!
+
+current
+	current isNil ifTrue: [current := self new].
+	^current
+!
+
+current: aTestResource
+	current := aTestResource
+! !
+
+!TestResource class methodsFor:'Creation'!
+
+new
+	^super new initialize
+!
+
+reset
+	current notNil ifTrue: 
+		[current tearDown.
+		current := nil]
+! !
+
+!TestResource class methodsFor:'Testing'!
+
+isAbstract
+	"Override to true if a TestCase subclass is Abstract and should not have
+	TestCase instances built from it"
+	^self name = #TestResource
+!
+
+isAvailable
+	^self current notNil
+!
+
+isUnavailable
+	^self isAvailable not
+! !
+
+!TestResource methodsFor:'Accessing'!
+
+description
+	description isNil ifTrue: [^''].
+	^description
+!
+
+description: aString
+	description := aString
+!
+
+name
+	name isNil ifTrue: [^self printString].
+	^name
+!
+
+name: aString
+	name := aString
+! !
+
+!TestResource methodsFor:'Init / Release'!
+
+initialize
+! !
+
+!TestResource methodsFor:'Printing'!
+
+printOn: aStream
+	aStream nextPutAll: self class printString
+! !
+
+!TestResource methodsFor:'Running'!
+
+setUp
+	"Does nothing. Subclasses should override this
+	to initialize their resource"
+!
+
+tearDown
+	"Does nothing. Subclasses should override this
+	to tear down their resource"
+! !
+
+!TestResource methodsFor:'Testing'!
+
+isAvailable
+	"override to provide information on the readiness of the resource"
+	^true
+!
+
+isUnavailable
+	"override to provide information on the readiness of the resource"
+	^self isAvailable not
+! !
+
+!TestResource class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestResource.st,v 1.1 2001-12-13 21:25:37 cg Exp $'
+! !