SimpleTestResource.st
author Claus Gittinger <cg@exept.de>
Wed, 29 May 2019 01:12:49 +0200
changeset 747 1dcb53cf964d
parent 222 8e6f482297fa
child 611 1eecc860f4a5
child 664 e31b2e7b658d
permissions -rw-r--r--
#FEATURE by cg class: TestCase added: #invokeTestMethod changed: #performTest support timeout annotation

"{ Package: 'stx:goodies/sunit' }"

TestResource subclass:#SimpleTestResource
	instanceVariableNames:'runningState hasRun hasSetup'
	classVariableNames:''
	poolDictionaries:''
	category:'SUnit-Tests'
!

SimpleTestResource class instanceVariableNames:'preventAvailability'

"
 The following class instance variables are inherited by this class:

	TestResource - current
	TestAsserter -
	Object -
"
!


!SimpleTestResource class methodsFor:'accessing'!

allowAvailability
	^preventAvailability isNil
!

rawCurrentForTest
	^current
! !

!SimpleTestResource class methodsFor:'utility'!

preventAvailabilityDuring: aBlock
	"Only setter of preventAvailability."

	preventAvailability := false.
	^aBlock ensure: [preventAvailability := nil]
! !

!SimpleTestResource methodsFor:'accessing'!

runningState

	^runningState
!

runningState: aSymbol

	runningState := aSymbol
! !

!SimpleTestResource methodsFor:'running'!

setRun
	hasRun := true
!

setUp

	self runningState: self startedStateSymbol.
	hasSetup := true
!

startedStateSymbol

	^#started
!

stoppedStateSymbol

	^#stopped
!

tearDown

	self runningState: self stoppedStateSymbol
! !

!SimpleTestResource methodsFor:'testing'!

hasRun
	^hasRun
!

hasSetup
	^hasSetup
!

isAvailable
	^self class allowAvailability and:
		[self runningState == self startedStateSymbol]
! !

!SimpleTestResource class methodsFor:'documentation'!

version_SVN
    ^ '§Id: SimpleTestResource.st 214 2011-03-14 12:22:21Z vranyj1 §'
! !