"{ 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]
"self withAllSubclassesDo:[:each| each reset]"
! !
!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
self setUp
! !
!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.3 2002-06-19 12:21:01 cg Exp $'
! !