author | vranyj1 |
Thu, 23 Jun 2011 21:36:25 +0000 | |
branch | jk_new_structure |
changeset 865 | 82615f7deade |
parent 859 | 56bc5e063b7d |
child 877 | f5a5b93e1c78 |
permissions | -rw-r--r-- |
761 | 1 |
"{ Package: 'stx:libjava' }" |
2 |
||
859
56bc5e063b7d
Common code from JUnitTestCaseProxy and TestletTestCaseProxy moved to a common superclass
vranyj1
parents:
855
diff
changeset
|
3 |
JavaTestCaseProxy subclass:#TestletTestCaseProxy |
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
4 |
instanceVariableNames:'harness' |
761 | 5 |
classVariableNames:'TestCases' |
6 |
poolDictionaries:'' |
|
859
56bc5e063b7d
Common code from JUnitTestCaseProxy and TestletTestCaseProxy moved to a common superclass
vranyj1
parents:
855
diff
changeset
|
7 |
category:'Languages-Java-Tests-Proxies' |
761 | 8 |
! |
9 |
||
10 |
||
11 |
!TestletTestCaseProxy class methodsFor:'accessing'! |
|
12 |
||
13 |
lookupHierarchyRoot |
|
14 |
^ TestletTestCaseProxy |
|
15 |
||
16 |
"Created: / 01-03-2011 / 11:41:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17 |
"Modified: / 01-03-2011 / 14:54:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
18 |
"Modified: / 29-04-2011 / 10:25:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
19 |
! |
|
20 |
||
21 |
selector: aSymbol |
|
22 |
||
23 |
^super selector: aSymbol |
|
24 |
||
25 |
"Created: / 01-03-2011 / 11:55:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
26 |
! ! |
|
27 |
||
28 |
!TestletTestCaseProxy class methodsFor:'private'! |
|
29 |
||
30 |
testSelectors |
|
31 |
"testlet always has only one test method, but maybe for the future.." |
|
32 |
||
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
|
33 |
^ #( #'test(Lgnu.testlet.TestHarness;)' ). |
761 | 34 |
|
35 |
"Created: / 01-03-2011 / 10:49:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
36 |
"Modified: / 03-03-2011 / 00:34:39 / Marcel Hlopko <hlopik@gmail.com>" |
|
37 |
"Modified: / 04-03-2011 / 00:05:51 / 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
|
38 |
"Modified: / 29-05-2011 / 22:54:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 39 |
! ! |
40 |
||
41 |
!TestletTestCaseProxy class methodsFor:'queries'! |
|
42 |
||
854
e165b3da9adb
Fixes for running tests in separate processes (required since VM often crash)
vranyj1
parents:
853
diff
changeset
|
43 |
isTestlet |
e165b3da9adb
Fixes for running tests in separate processes (required since VM often crash)
vranyj1
parents:
853
diff
changeset
|
44 |
^ true |
e165b3da9adb
Fixes for running tests in separate processes (required since VM often crash)
vranyj1
parents:
853
diff
changeset
|
45 |
|
761 | 46 |
! ! |
47 |
||
48 |
!TestletTestCaseProxy class methodsFor:'subclass creation'! |
|
49 |
||
50 |
for: javaClass |
|
51 |
"Answers a new (anonymous) testcase proxy for |
|
52 |
given javaClass" |
|
53 |
||
54 |
self assert: javaClass isJavaClass description: 'Not a java class'. |
|
55 |
self assert: javaClass isTestletLike |
|
56 |
description: 'Not a testcase-like class'. |
|
859
56bc5e063b7d
Common code from JUnitTestCaseProxy and TestletTestCaseProxy moved to a common superclass
vranyj1
parents:
855
diff
changeset
|
57 |
^self forClassNamed: javaClass name |
761 | 58 |
|
59 |
"Created: / 01-03-2011 / 10:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
60 |
"Modified: / 03-03-2011 / 00:20:49 / Marcel Hlopko <hlopik@gmail.com>" |
|
61 |
"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
|
62 |
"Modified: / 21-06-2011 / 17:08:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 63 |
! ! |
64 |
||
65 |
!TestletTestCaseProxy methodsFor:'accessing'! |
|
66 |
||
855
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
67 |
nameForHDTestReport |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
68 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
69 |
^(self class javaClassName copyReplaceAll:$/ with: $.) copyTo: (self class javaClassName lastIndexOf: $/) - 1. |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
70 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
71 |
"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
|
72 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
73 |
! |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
74 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
75 |
selectorForHDTestReport |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
76 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
77 |
^self class javaClassName copyFrom: |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
78 |
(self class javaClassName lastIndexOf: $/) + 1 |
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
79 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
80 |
|
809b1dc41615
use nameForHDTestReport and selectorForHDTestReport to identify test
vranyj1
parents:
854
diff
changeset
|
81 |
|
761 | 82 |
! ! |
83 |
||
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
84 |
!TestletTestCaseProxy methodsFor:'error handling'! |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
85 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
86 |
doesNotUnderstand: aMessage |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
87 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
88 |
aMessage selector == #'check(Z)V' ifTrue: [ |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
89 |
aMessage arg1 == 0 ifTrue: |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
90 |
[TestResult failure sunitSignalWith: 'Testlet failed'] |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
91 |
] ifFalse:[ aMessage selector == #'check(ZLjava/lang/String;)V' ifTrue:[ |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
92 |
aMessage arg1 == 0 ifTrue: |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
93 |
[TestResult failure sunitSignalWith: (Java as_ST_String: aMessage arguments second)] |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
94 |
]]. |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
95 |
(harness respondsTo: aMessage selector) ifTrue: |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
96 |
[^aMessage sendTo: harness]. |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
97 |
^super doesNotUnderstand: aMessage |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
98 |
|
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
99 |
"Created: / 31-05-2011 / 16:30:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
100 |
! ! |
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
101 |
|
761 | 102 |
!TestletTestCaseProxy methodsFor:'private'! |
103 |
||
104 |
harnessMock |
|
105 |
^ (Java classForName: 'stx.libjava.tests.mocks.TestletHarnessMock') new. |
|
106 |
||
107 |
"Modified: / 29-04-2011 / 10:52:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
108 |
! |
|
109 |
||
110 |
performTest |
|
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
111 |
| handlerBlock | |
824 | 112 |
|
113 |
handlerBlock := [:ex | TestResult failure sunitSignalWith: ex description]. |
|
761 | 114 |
|
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
115 |
harness := self harnessMock. |
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
|
116 |
|
824 | 117 |
[ JavaVM unimplementedNativeMethodSignal |
118 |
handle: |
|
119 |
handlerBlock |
|
120 |
do: [ |
|
121 |
self javaClass new |
|
122 |
perform: 'test(Lgnu/testlet/TestHarness;)V' sunitAsSymbol |
|
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
123 |
with: self |
824 | 124 |
]. |
125 |
] on: JavaError do: [:ex | |
|
126 |
TestResult failure sunitSignalWith: ex description |
|
127 |
]. |
|
128 |
||
826
db53b9c842d7
- TestletTestCaseProxy: debugging support improved.
vranyj1
parents:
824
diff
changeset
|
129 |
"/((harness instVarNamed: 'passed') = 0 ) ifTrue: [ TestResult failure sunitSignalWith: 'Test failed' ]. |
761 | 130 |
|
131 |
"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
|
132 |
"Modified: / 29-05-2011 / 23:19:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
853
aa9af509e506
TestletTestCaseProxy: added classvar to specify whether run the test in separate process
vranyj1
parents:
826
diff
changeset
|
133 |
"Modified: / 13-06-2011 / 17:03:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 134 |
! ! |
135 |
||
136 |
!TestletTestCaseProxy class methodsFor:'documentation'! |
|
137 |
||
138 |
version_SVN |
|
139 |
^ '$Id$' |
|
140 |
! ! |