author | vranyj1 |
Tue, 09 Aug 2011 16:21:26 +0000 | |
branch | jk_new_structure |
changeset 899 | ac6820bae6ff |
parent 895 | ddeff39cfdb9 |
child 901 | 64a889b68bef |
permissions | -rw-r--r-- |
877 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
3 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
4 |
SWING Research Group, Czech Technical University in Prague |
|
5 |
||
6 |
Parts of the code written by Claus Gittinger are under following |
|
7 |
license: |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
16 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed: |
|
17 |
||
18 |
Permission is hereby granted, free of charge, to any person |
|
19 |
obtaining a copy of this software and associated documentation |
|
20 |
files (the 'Software'), to deal in the Software without |
|
21 |
restriction, including without limitation the rights to use, |
|
22 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
23 |
copies of the Software, and to permit persons to whom the |
|
24 |
Software is furnished to do so, subject to the following |
|
25 |
conditions: |
|
26 |
||
27 |
The above copyright notice and this permission notice shall be |
|
28 |
included in all copies or substantial portions of the Software. |
|
29 |
||
30 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
31 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
32 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
33 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
34 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
35 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
36 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
37 |
OTHER DEALINGS IN THE SOFTWARE. |
|
38 |
||
39 |
[1] Code written at SWING Research Group contain a signature |
|
40 |
of one of the above copright owners. |
|
41 |
" |
|
761 | 42 |
"{ Package: 'stx:libjava' }" |
43 |
||
859
56bc5e063b7d
Common code from JUnitTestCaseProxy and TestletTestCaseProxy moved to a common superclass
vranyj1
parents:
855
diff
changeset
|
44 |
JavaTestCaseProxy subclass:#TestletTestCaseProxy |
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
45 |
instanceVariableNames:'harness' |
761 | 46 |
classVariableNames:'TestCases' |
47 |
poolDictionaries:'' |
|
859
56bc5e063b7d
Common code from JUnitTestCaseProxy and TestletTestCaseProxy moved to a common superclass
vranyj1
parents:
855
diff
changeset
|
48 |
category:'Languages-Java-Tests-Proxies' |
761 | 49 |
! |
50 |
||
877 | 51 |
!TestletTestCaseProxy class methodsFor:'documentation'! |
52 |
||
53 |
copyright |
|
54 |
" |
|
55 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
56 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
57 |
SWING Research Group, Czech Technical University in Prague |
|
58 |
||
59 |
Parts of the code written by Claus Gittinger are under following |
|
60 |
license: |
|
61 |
||
62 |
This software is furnished under a license and may be used |
|
63 |
only in accordance with the terms of that license and with the |
|
64 |
inclusion of the above copyright notice. This software may not |
|
65 |
be provided or otherwise made available to, or used by, any |
|
66 |
other person. No title to or ownership of the software is |
|
67 |
hereby transferred. |
|
68 |
||
69 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed: |
|
70 |
||
71 |
Permission is hereby granted, free of charge, to any person |
|
72 |
obtaining a copy of this software and associated documentation |
|
73 |
files (the 'Software'), to deal in the Software without |
|
74 |
restriction, including without limitation the rights to use, |
|
75 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
76 |
copies of the Software, and to permit persons to whom the |
|
77 |
Software is furnished to do so, subject to the following |
|
78 |
conditions: |
|
79 |
||
80 |
The above copyright notice and this permission notice shall be |
|
81 |
included in all copies or substantial portions of the Software. |
|
82 |
||
83 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
84 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
85 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
86 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
87 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
88 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
89 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
90 |
OTHER DEALINGS IN THE SOFTWARE. |
|
91 |
||
92 |
[1] Code written at SWING Research Group contain a signature |
|
93 |
of one of the above copright owners. |
|
94 |
||
95 |
" |
|
96 |
! ! |
|
761 | 97 |
|
98 |
!TestletTestCaseProxy class methodsFor:'accessing'! |
|
99 |
||
100 |
lookupHierarchyRoot |
|
101 |
^ TestletTestCaseProxy |
|
102 |
||
103 |
"Created: / 01-03-2011 / 11:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
104 |
"Modified: / 01-03-2011 / 14:54:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
105 |
"Modified: / 29-04-2011 / 10:25:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
106 |
! |
|
107 |
||
108 |
selector: aSymbol |
|
109 |
||
110 |
^super selector: aSymbol |
|
111 |
||
112 |
"Created: / 01-03-2011 / 11:55:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
113 |
! ! |
|
114 |
||
115 |
!TestletTestCaseProxy class methodsFor:'private'! |
|
116 |
||
117 |
testSelectors |
|
118 |
"testlet always has only one test method, but maybe for the future.." |
|
119 |
||
899 | 120 |
^ #( #'test(Lgnu/testlet/TestHarness;)V' ). |
761 | 121 |
|
122 |
"Created: / 01-03-2011 / 10:49:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
123 |
"Modified: / 03-03-2011 / 00:34:39 / Marcel Hlopko <hlopik@gmail.com>" |
|
820
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
761
diff
changeset
|
124 |
"Modified: / 29-05-2011 / 22:54:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
899 | 125 |
"Modified: / 09-08-2011 / 16:31:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 126 |
! ! |
127 |
||
128 |
!TestletTestCaseProxy class methodsFor:'queries'! |
|
129 |
||
854
e165b3da9adb
Fixes for running tests in separate processes (required since VM often crash)
vranyj1
parents:
853
diff
changeset
|
130 |
isTestlet |
e165b3da9adb
Fixes for running tests in separate processes (required since VM often crash)
vranyj1
parents:
853
diff
changeset
|
131 |
^ true |
e165b3da9adb
Fixes for running tests in separate processes (required since VM often crash)
vranyj1
parents:
853
diff
changeset
|
132 |
|
761 | 133 |
! ! |
134 |
||
135 |
!TestletTestCaseProxy class methodsFor:'subclass creation'! |
|
136 |
||
137 |
for: javaClass |
|
138 |
"Answers a new (anonymous) testcase proxy for |
|
139 |
given javaClass" |
|
140 |
||
141 |
self assert: javaClass isJavaClass description: 'Not a java class'. |
|
142 |
self assert: javaClass isTestletLike |
|
143 |
description: 'Not a testcase-like class'. |
|
859
56bc5e063b7d
Common code from JUnitTestCaseProxy and TestletTestCaseProxy moved to a common superclass
vranyj1
parents:
855
diff
changeset
|
144 |
^self forClassNamed: javaClass name |
761 | 145 |
|
146 |
"Created: / 01-03-2011 / 10:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
147 |
"Modified: / 03-03-2011 / 00:20:49 / Marcel Hlopko <hlopik@gmail.com>" |
|
148 |
"Modified: / 29-04-2011 / 10:21:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
859
56bc5e063b7d
Common code from JUnitTestCaseProxy and TestletTestCaseProxy moved to a common superclass
vranyj1
parents:
855
diff
changeset
|
149 |
"Modified: / 21-06-2011 / 17:08:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 150 |
! ! |
151 |
||
152 |
!TestletTestCaseProxy methodsFor:'accessing'! |
|
153 |
||
855
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
154 |
nameForHDTestReport |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
155 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
156 |
^(self class javaClassName copyReplaceAll:$/ with: $.) copyTo: (self class javaClassName lastIndexOf: $/) - 1. |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
157 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
158 |
"Created: / 01-04-2011 / 16:10:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
159 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
160 |
! |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
161 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
162 |
selectorForHDTestReport |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
163 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
164 |
^self class javaClassName copyFrom: |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
165 |
(self class javaClassName lastIndexOf: $/) + 1 |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
166 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
167 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
168 |
|
761 | 169 |
! ! |
170 |
||
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
171 |
!TestletTestCaseProxy methodsFor:'error handling'! |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
172 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
173 |
doesNotUnderstand: aMessage |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
174 |
|
895 | 175 |
| sel arg | |
892 | 176 |
sel := aMessage selector. |
895 | 177 |
arg := aMessage arg1. |
178 |
(sel includes:$() ifTrue:[ |
|
179 |
sel == #'check(Z)V' ifTrue:[ |
|
180 |
self assert: arg == 1 description: ('Assertion failed (checkpoint: %1)' bindWith: self checkPointName). |
|
181 |
^self. |
|
182 |
]. |
|
183 |
sel == #'debug(Ljava/lang/String;Z)V' ifTrue:[ |
|
184 |
Transcript show: (Java as_ST_String: arg). |
|
185 |
aMessage arguments second == 1 ifTrue:[ |
|
186 |
Transcript cr. |
|
187 |
]. |
|
188 |
^self |
|
189 |
]. |
|
190 |
sel == #'info(Ljava/lang/String)V' ifTrue:[ |
|
191 |
Transcript showCR: (Java as_ST_String: arg). |
|
192 |
]. |
|
193 |
sel == #'unimplemented(Ljava/lang/String;)V' ifTrue:[ |
|
194 |
self error: ('Unimplemented harness method: %1' bindWith: (Java as_ST_String: arg)). |
|
195 |
^self |
|
196 |
]. |
|
892 | 197 |
]. |
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
198 |
^super doesNotUnderstand: aMessage |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
199 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
200 |
"Created: / 31-05-2011 / 16:30:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
201 |
! ! |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
202 |
|
761 | 203 |
!TestletTestCaseProxy methodsFor:'private'! |
204 |
||
895 | 205 |
checkPointName |
206 |
||
207 |
| jstring | |
|
208 |
jstring := harness instVarNamed: #checkPoint. |
|
209 |
^jstring notNil ifTrue:[ |
|
210 |
Java as_ST_String: jstring |
|
211 |
] ifFalse:[ |
|
212 |
'<no checkpoint set>' |
|
213 |
] |
|
761 | 214 |
|
215 |
"Modified: / 29-04-2011 / 10:52:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
895 | 216 |
"Created: / 09-08-2011 / 12:16:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
217 |
! |
|
218 |
||
219 |
createHarness |
|
220 |
||
221 |
harness := (Java classForName: 'stx.libjava.tests.TestHarness') new. |
|
222 |
harness instVarNamed: #proxy put: self. |
|
223 |
||
224 |
"Modified: / 29-04-2011 / 10:52:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
225 |
"Created: / 09-08-2011 / 11:29:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
761 | 226 |
! |
227 |
||
228 |
performTest |
|
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
229 |
| handlerBlock | |
824 | 230 |
|
231 |
handlerBlock := [:ex | TestResult failure sunitSignalWith: ex description]. |
|
761 | 232 |
|
895 | 233 |
self createHarness. |
820
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
761
diff
changeset
|
234 |
|
824 | 235 |
[ JavaVM unimplementedNativeMethodSignal |
236 |
handle: |
|
237 |
handlerBlock |
|
238 |
do: [ |
|
239 |
self javaClass new |
|
240 |
perform: 'test(Lgnu/testlet/TestHarness;)V' sunitAsSymbol |
|
895 | 241 |
with: harness |
824 | 242 |
]. |
243 |
] on: JavaError do: [:ex | |
|
244 |
TestResult failure sunitSignalWith: ex description |
|
245 |
]. |
|
246 |
||
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
247 |
"/((harness instVarNamed: 'passed') = 0 ) ifTrue: [ TestResult failure sunitSignalWith: 'Test failed' ]. |
761 | 248 |
|
249 |
"Created: / 01-03-2011 / 14:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
820
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
761
diff
changeset
|
250 |
"Modified: / 29-05-2011 / 23:19:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
895 | 251 |
"Modified: / 09-08-2011 / 12:13:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 252 |
! ! |
253 |
||
254 |
!TestletTestCaseProxy class methodsFor:'documentation'! |
|
255 |
||
256 |
version_SVN |
|
257 |
^ '$Id$' |
|
258 |
! ! |