author | HG Automerge |
Thu, 24 Nov 2016 21:56:23 +0000 | |
branch | jv |
changeset 673 | 7c5c1bc3be7b |
parent 664 | e31b2e7b658d |
child 724 | 4dae63fce9f9 |
permissions | -rw-r--r-- |
222 | 1 |
"{ Package: 'stx:goodies/sunit' }" |
2 |
||
664
e31b2e7b658d
FIX: Do not treat skipped test as passed!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
222
diff
changeset
|
3 |
"{ NameSpace: Smalltalk }" |
e31b2e7b658d
FIX: Do not treat skipped test as passed!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
222
diff
changeset
|
4 |
|
222 | 5 |
SimpleTestResourceTestCase subclass:#ManyTestResourceTestCase |
6 |
instanceVariableNames:'' |
|
7 |
classVariableNames:'' |
|
8 |
poolDictionaries:'' |
|
9 |
category:'SUnit-Tests' |
|
10 |
! |
|
11 |
||
12 |
||
13 |
!ManyTestResourceTestCase class methodsFor:'accessing'! |
|
14 |
||
15 |
resources |
|
16 |
^super resources, (Array with: SimpleTestResourceA with: SimpleTestResourceB) |
|
17 |
! ! |
|
18 |
||
19 |
!ManyTestResourceTestCase class methodsFor:'testing'! |
|
20 |
||
21 |
shouldInheritSelectors |
|
22 |
^true |
|
23 |
! ! |
|
24 |
||
25 |
!ManyTestResourceTestCase methodsFor:'running'! |
|
26 |
||
27 |
testTearDownOrder |
|
28 |
| myResourceSetUpOrder myResourceReverseTearDownOrder | |
|
29 |
myResourceReverseTearDownOrder := OrderedCollection new: 7. |
|
30 |
myResourceSetUpOrder := (OrderedCollection new: 7) |
|
31 |
add: SimpleTestResource; |
|
32 |
add: SimpleTestResourceA1; |
|
33 |
add: SimpleTestResourceA2; |
|
34 |
add: SimpleTestResourceA; |
|
35 |
add: SimpleTestResourceB1; |
|
36 |
add: SimpleTestResourceB; |
|
37 |
yourself. |
|
38 |
self assert: (myResourceSetUpOrder allSatisfy: [:each | each isAvailable]) |
|
39 |
description: 'At test start, not all my resources were set up'. |
|
40 |
self class resources do: |
|
41 |
[:each | each resetOrAddResourcesTo: myResourceReverseTearDownOrder]. |
|
42 |
self assert: myResourceReverseTearDownOrder = myResourceSetUpOrder |
|
43 |
description: 'Wrong order for tearDown'. |
|
44 |
self assert: (myResourceSetUpOrder allSatisfy: [:each | each isAvailable]) |
|
45 |
description: 'At test start, not all my resources were set up'. |
|
46 |
! ! |
|
47 |
||
48 |
!ManyTestResourceTestCase methodsFor:'utility'! |
|
49 |
||
50 |
clearOuterResourceStateDuring: aBlock |
|
51 |
"This self-testing test must clear the outer state of its resources before starting and after finishing, so that it can construct test cases and suites of itself and test them." |
|
52 |
||
53 |
self assert: SimpleTestResourceA1 isAlreadyAvailable |
|
54 |
description: 'The resource was not set up for the test'. |
|
55 |
SimpleTestResourceA reset. |
|
56 |
SimpleTestResourceB reset. |
|
57 |
SimpleTestResourceA1 reset. |
|
58 |
self deny: SimpleTestResourceA1 isAlreadyAvailable |
|
59 |
description: 'The resource was still set up before we began the run'. |
|
60 |
^[super clearOuterResourceStateDuring: aBlock] sunitEnsure: |
|
61 |
[self deny: SimpleTestResourceA1 isAlreadyAvailable |
|
62 |
description: 'The resource was still set up after we finished the run'. |
|
63 |
self deny: SimpleTestResourceB1 isAlreadyAvailable |
|
64 |
description: 'The resource was still set up after we finished the run'. |
|
65 |
SimpleTestResourceA isAvailable. |
|
66 |
self assert: SimpleTestResourceA1 isAlreadyAvailable |
|
67 |
description: 'The resource was not set up again after the test'. |
|
68 |
SimpleTestResourceB isAvailable. |
|
69 |
self assert: SimpleTestResourceB1 isAlreadyAvailable |
|
70 |
description: 'The resource was not set up again after the test'.]. |
|
71 |
||
72 |
"Modified: / 11-09-2010 / 16:44:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
73 |
! ! |
|
74 |
||
75 |
!ManyTestResourceTestCase class methodsFor:'documentation'! |
|
76 |
||
77 |
version_SVN |
|
78 |
^ '§Id: ManyTestResourceTestCase.st 214 2011-03-14 12:22:21Z vranyj1 §' |
|
79 |
! ! |
|
664
e31b2e7b658d
FIX: Do not treat skipped test as passed!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
222
diff
changeset
|
80 |