summaryrefslogtreecommitdiff
path: root/docs/TestSuite
blob: 295d02cddc60a3fb9debf0af68eadc49aefe110f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
Assertions
-------------------------------------------------------------------------------
fail
assertTrue
assertFalse
assertNull
assertNotNull
assertEquals
	Test actual is equal to expected.
	
	<assertEquals actual="result" expected="expectedResult" ignoreCase="true/false/auto" context="attribute/element" bitmask="..."/>
	
	For Collections (or Lists), need to check neither list is null, then that both lists have the same size, then that all their elements are equal.
	
	ignoreCase="auto"
		if contentType == "text/html":
			if context == "attribute", do case insensitive test
			if context == "element", do case sensitive test against expected.toUpperCase()
	context attribute used in combination with ignoreCase="auto"
	bitmask attribute used in DOM Level 3 only.  Tests: (actual & bitmask) equals (expectedResult & bitmask) where bitmask is an int

assertNotEquals

assertSame
	Tests two objects for identity.
	If not identical, test if either are null, or either are not Nodes.  If so, delegate to assertEquals()

assertInstanceOf
	Used in [hc_]namednodemapreturnattrnode.xml
	Can use Node.getNodeType() to get runtime type

assertSize
	Tests a Java Collection has the specified size. 
	
	<assertSize size="2" collection="notifications"/>

assertEventCount
assertURIEquals
assertImplementationException

assertDOMException
	Tests that a DOMException is thrown with a specified code.  Try/catching not nested.
	
	<assertDOMException id="setValue_throws_NO_MODIFICATION_ERR">
	    <NO_MODIFICATION_ALLOWED_ERR>
	        <removeChild obj="attrNode" oldChild="textNode" var="removedNode"/>
	    </NO_MODIFICATION_ALLOWED_ERR>
	</assertDOMException>
	
	boolean success = false;
	try {
    	removedNode = attrNode.removeChild(textNode);
    } catch (DOMException ex) {
    	success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
    }
    assertTrue(success);
    
assertLowerSeverity
	DOM Level 3 Core only

Conditions
-------------------------------------------------------------------------------
same
	(not used)

equals
notEquals
less
lessOrEquals
greater
greaterOrEquals
isNull
notNull
and
or
xor
not

instanceOf
	(not used)

isTrue
isFalse
hasSize
contentType
contains
hasFeature
implementationAttribute


Statements
-------------------------------------------------------------------------------
var
	Can contain nested <member> elements when the var has type Collection

assign
	<assign var="..." value="..."/>

increment
decrement
	<increment var="..." value="..."/>

append
	<append collection="..." item="..."/>
	Append an object to the end of a Collection.
	In Java, this is implemented with an ArrayList.

plus
subtract
mult
divide
load
implementation
hasFeature

implementationAttribute
	Set DocumentBuilder attributes (such as validating)

if
while

try
Fail if reach the end of the try without throwing an exception specified in <catch>
<try>
	...
	<catch>
		<DOMException code="..."/>
		<DOMException code="..."/>
		...
	</catch>
</try>

No nesting in test cases, but sometimes more than one instance in a single test.

for-each
	<for-each collection="..." member="...">

comment
	Only used in DOM Level 3 XPath.

return
	Only used in DOM Level 2/3.  Returns immediately from method call with optional @value

userObj
	(not used)

atEvents
capturedEvents
bubbledEvents
allEvents
	DOM Level 2 Events only

createXPathEvaluator
	DOM Level 3 XPath only
	
getResourceURI
	DOM Level 3 LS only

substring
	<substringData var="..." obj="..." offset="..." count="..."/>
	Calls @obj.substringData() where obj is an instance of CharacterData

createTempURI
	DOMImplementationRegistry.newInstance

allErrors
	Only used in DOM Level 3
	Calls org.w3c.domts.DOMErrorMonitor.getAllErrors(), which is an instance of DOMErrorHandler

allNotifications
operation
key
dst

Datatypes
-------------------------------------------------------------------------------
int
short
double
boolean
	Primitives

DOMString

List
	In Java, an ArrayList instance typed as a List

Collection
	In Java, an ArrayList instance typed as a Collection
	
	<var name="expectedResult" type="Collection">
		<member>"ent1"</member>
		<member>"ent2"</member>

EventMonitor
	DOM Level 2 Events only

DOMErrorMonitor
	DOM Level 3 only
	
UserDataMonitor
UserDataNotification
	DOM Level 3 Core only

Attr
CDATASection
CharacterData
Comment
Document
DocumentFragment
DocumentType
DOMImplementation
Element
Entity
EntityReference
NamedNodeMap
Node
NodeList
Notation
ProcessingInstruction
Text
	DOM types