TestResource.st
author Claus Gittinger <cg@exept.de>
Thu, 13 Dec 2001 22:25:37 +0100
changeset 44 63d3c94197da
child 68 9fd111438d60
permissions -rw-r--r--
initial checkin

"{ 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 $'
! !