|
1 "{ Package: 'stx:goodies/sunit' }" |
|
2 |
|
3 Object subclass:#TestCaseOutcome |
|
4 instanceVariableNames:'testCase result properties' |
|
5 classVariableNames:'' |
|
6 poolDictionaries:'' |
|
7 category:'SUnit-Base' |
|
8 ! |
|
9 |
|
10 !TestCaseOutcome class methodsFor:'documentation'! |
|
11 |
|
12 documentation |
|
13 " |
|
14 will keep additional info for a testCase run: |
|
15 startTime, endTime, |
|
16 backtrace (if fail or error) |
|
17 and collectedStdout |
|
18 " |
|
19 ! ! |
|
20 |
|
21 !TestCaseOutcome class methodsFor:'instance creation'! |
|
22 |
|
23 forCase: aTestCase |
|
24 |
|
25 ^self new testCase: aTestCase; yourself |
|
26 |
|
27 "Created: / 16-08-2011 / 15:24:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
28 ! ! |
|
29 |
|
30 !TestCaseOutcome methodsFor:'accessing'! |
|
31 |
|
32 collectedOutput |
|
33 |
|
34 ^self propertyAt: #collectedOutput |
|
35 |
|
36 "Modified: / 16-08-2011 / 15:27:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
37 "Created: / 16-08-2011 / 18:19:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
38 ! |
|
39 |
|
40 collectedOutput: aString |
|
41 |
|
42 ^self propertyAt: #collectedOutput put: aString |
|
43 |
|
44 "Modified: / 16-08-2011 / 15:28:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
45 "Created: / 16-08-2011 / 18:19:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
46 ! |
|
47 |
|
48 endTime |
|
49 |
|
50 ^self propertyAt: #endTime |
|
51 |
|
52 "Modified: / 16-08-2011 / 15:28:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
53 ! |
|
54 |
|
55 endTime: anObject |
|
56 |
|
57 ^self propertyAt: #endTime put: anObject |
|
58 |
|
59 "Modified: / 16-08-2011 / 15:28:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
60 ! |
|
61 |
|
62 exceptionDetail |
|
63 |
|
64 ^self propertyAt: #exceptionDetail |
|
65 |
|
66 "Modified: / 16-08-2011 / 15:29:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
67 ! |
|
68 |
|
69 exceptionDetail: anObject |
|
70 |
|
71 ^self propertyAt: #exceptionDetail put: anObject |
|
72 |
|
73 "Modified: / 16-08-2011 / 15:29:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
74 ! |
|
75 |
|
76 propertyAt: aSymbol |
|
77 |
|
78 self propertyAt: aSymbol ifAbsent: [nil] |
|
79 |
|
80 "Created: / 16-08-2011 / 15:26:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
81 ! |
|
82 |
|
83 propertyAt: aSymbol ifAbsent: aBlock |
|
84 |
|
85 properties isNil ifTrue: [^aBlock value]. |
|
86 ^properties at: aSymbol ifAbsent:aBlock. |
|
87 |
|
88 "Created: / 16-08-2011 / 15:27:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
89 ! |
|
90 |
|
91 propertyAt: aSymbol put: anObject |
|
92 |
|
93 properties isNil ifTrue: [properties := Dictionary new]. |
|
94 properties at: aSymbol put: anObject. |
|
95 |
|
96 "Created: / 16-08-2011 / 15:28:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
97 ! |
|
98 |
|
99 result |
|
100 ^ result |
|
101 ! |
|
102 |
|
103 result:something |
|
104 result := something. |
|
105 ! |
|
106 |
|
107 selector |
|
108 |
|
109 ^testCase selector |
|
110 |
|
111 "Created: / 16-08-2011 / 15:38:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
112 ! |
|
113 |
|
114 startTime |
|
115 |
|
116 ^self propertyAt: #startTime |
|
117 |
|
118 "Modified: / 16-08-2011 / 15:29:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
119 ! |
|
120 |
|
121 startTime: anObject |
|
122 |
|
123 ^self propertyAt: #startTime put: anObject |
|
124 |
|
125 "Modified: / 16-08-2011 / 15:29:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
126 ! |
|
127 |
|
128 testCase |
|
129 ^ testCase |
|
130 ! |
|
131 |
|
132 testCase:something |
|
133 testCase := something. |
|
134 ! ! |
|
135 |
|
136 !TestCaseOutcome class methodsFor:'documentation'! |
|
137 |
|
138 version |
|
139 ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCaseOutcome.st,v 1.1 2011-08-16 18:18:17 vrany Exp $' |
|
140 ! |
|
141 |
|
142 version_CVS |
|
143 ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCaseOutcome.st,v 1.1 2011-08-16 18:18:17 vrany Exp $' |
|
144 ! ! |