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
|
|
36 |
current notNil ifTrue:
|
|
37 |
[current tearDown.
|
|
38 |
current := nil]
|
|
39 |
! !
|
|
40 |
|
68
|
41 |
!TestResource class methodsFor:'testing'!
|
44
|
42 |
|
|
43 |
isAbstract
|
|
44 |
"Override to true if a TestCase subclass is Abstract and should not have
|
|
45 |
TestCase instances built from it"
|
|
46 |
^self name = #TestResource
|
|
47 |
!
|
|
48 |
|
|
49 |
isAvailable
|
|
50 |
^self current notNil
|
|
51 |
!
|
|
52 |
|
|
53 |
isUnavailable
|
|
54 |
^self isAvailable not
|
|
55 |
! !
|
|
56 |
|
68
|
57 |
!TestResource methodsFor:'accessing'!
|
44
|
58 |
|
|
59 |
description
|
|
60 |
description isNil ifTrue: [^''].
|
|
61 |
^description
|
|
62 |
!
|
|
63 |
|
|
64 |
description: aString
|
|
65 |
description := aString
|
|
66 |
!
|
|
67 |
|
|
68 |
name
|
|
69 |
name isNil ifTrue: [^self printString].
|
|
70 |
^name
|
|
71 |
!
|
|
72 |
|
|
73 |
name: aString
|
|
74 |
name := aString
|
|
75 |
! !
|
|
76 |
|
68
|
77 |
!TestResource methodsFor:'init / release'!
|
44
|
78 |
|
|
79 |
initialize
|
|
80 |
! !
|
|
81 |
|
68
|
82 |
!TestResource methodsFor:'printing'!
|
44
|
83 |
|
|
84 |
printOn: aStream
|
|
85 |
aStream nextPutAll: self class printString
|
|
86 |
! !
|
|
87 |
|
68
|
88 |
!TestResource methodsFor:'running'!
|
44
|
89 |
|
|
90 |
setUp
|
|
91 |
"Does nothing. Subclasses should override this
|
|
92 |
to initialize their resource"
|
|
93 |
!
|
|
94 |
|
|
95 |
tearDown
|
|
96 |
"Does nothing. Subclasses should override this
|
|
97 |
to tear down their resource"
|
|
98 |
! !
|
|
99 |
|
68
|
100 |
!TestResource methodsFor:'testing'!
|
44
|
101 |
|
|
102 |
isAvailable
|
|
103 |
"override to provide information on the readiness of the resource"
|
|
104 |
^true
|
|
105 |
!
|
|
106 |
|
|
107 |
isUnavailable
|
|
108 |
"override to provide information on the readiness of the resource"
|
|
109 |
^self isAvailable not
|
|
110 |
! !
|
|
111 |
|
|
112 |
!TestResource class methodsFor:'documentation'!
|
|
113 |
|
|
114 |
version
|
68
|
115 |
^ '$Header: /cvs/stx/stx/goodies/sunit/TestResource.st,v 1.2 2002-02-26 10:30:15 cg Exp $'
|
44
|
116 |
! !
|