44
|
1 |
"{ Package: 'stx:goodies/sunit' }"
|
|
2 |
|
|
3 |
Object subclass:#TestResource
|
|
4 |
instanceVariableNames:'name description'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'SUnit-Base'
|
|
8 |
!
|
|
9 |
|
|
10 |
TestResource class instanceVariableNames:'current'
|
|
11 |
|
|
12 |
"
|
|
13 |
No other class instance variables are inherited by this class.
|
|
14 |
"
|
|
15 |
!
|
|
16 |
|
|
17 |
|
68
|
18 |
!TestResource class methodsFor:'accessing'!
|
44
|
19 |
|
|
20 |
current
|
|
21 |
current isNil ifTrue: [current := self new].
|
|
22 |
^current
|
|
23 |
!
|
|
24 |
|
|
25 |
current: aTestResource
|
|
26 |
current := aTestResource
|
|
27 |
! !
|
|
28 |
|
68
|
29 |
!TestResource class methodsFor:'creation'!
|
44
|
30 |
|
|
31 |
new
|
|
32 |
^super new initialize
|
|
33 |
!
|
|
34 |
|
|
35 |
reset
|
70
|
36 |
current notNil ifTrue:
|
|
37 |
[current tearDown.
|
|
38 |
current := nil]
|
|
39 |
|
|
40 |
"self withAllSubclassesDo:[:each| each reset]"
|
44
|
41 |
! !
|
|
42 |
|
68
|
43 |
!TestResource class methodsFor:'testing'!
|
44
|
44 |
|
|
45 |
isAbstract
|
|
46 |
"Override to true if a TestCase subclass is Abstract and should not have
|
|
47 |
TestCase instances built from it"
|
|
48 |
^self name = #TestResource
|
|
49 |
!
|
|
50 |
|
|
51 |
isAvailable
|
|
52 |
^self current notNil
|
|
53 |
!
|
|
54 |
|
|
55 |
isUnavailable
|
|
56 |
^self isAvailable not
|
|
57 |
! !
|
|
58 |
|
68
|
59 |
!TestResource methodsFor:'accessing'!
|
44
|
60 |
|
|
61 |
description
|
|
62 |
description isNil ifTrue: [^''].
|
|
63 |
^description
|
|
64 |
!
|
|
65 |
|
|
66 |
description: aString
|
|
67 |
description := aString
|
|
68 |
!
|
|
69 |
|
|
70 |
name
|
|
71 |
name isNil ifTrue: [^self printString].
|
|
72 |
^name
|
|
73 |
!
|
|
74 |
|
|
75 |
name: aString
|
|
76 |
name := aString
|
|
77 |
! !
|
|
78 |
|
68
|
79 |
!TestResource methodsFor:'init / release'!
|
44
|
80 |
|
|
81 |
initialize
|
70
|
82 |
self setUp
|
44
|
83 |
! !
|
|
84 |
|
68
|
85 |
!TestResource methodsFor:'printing'!
|
44
|
86 |
|
|
87 |
printOn: aStream
|
|
88 |
aStream nextPutAll: self class printString
|
|
89 |
! !
|
|
90 |
|
68
|
91 |
!TestResource methodsFor:'running'!
|
44
|
92 |
|
|
93 |
setUp
|
|
94 |
"Does nothing. Subclasses should override this
|
|
95 |
to initialize their resource"
|
|
96 |
!
|
|
97 |
|
|
98 |
tearDown
|
|
99 |
"Does nothing. Subclasses should override this
|
|
100 |
to tear down their resource"
|
|
101 |
! !
|
|
102 |
|
68
|
103 |
!TestResource methodsFor:'testing'!
|
44
|
104 |
|
|
105 |
isAvailable
|
|
106 |
"override to provide information on the readiness of the resource"
|
|
107 |
^true
|
|
108 |
!
|
|
109 |
|
|
110 |
isUnavailable
|
|
111 |
"override to provide information on the readiness of the resource"
|
|
112 |
^self isAvailable not
|
|
113 |
! !
|
|
114 |
|
|
115 |
!TestResource class methodsFor:'documentation'!
|
|
116 |
|
|
117 |
version
|
70
|
118 |
^ '$Header: /cvs/stx/stx/goodies/sunit/TestResource.st,v 1.3 2002-06-19 12:21:01 cg Exp $'
|
44
|
119 |
! !
|