Assertions
-------------------------------------------------------------------------------
fail
assert(false);
assertTrue
assertFalse
@actual is a variable name, of type boolean (or castable to boolean?)
or evaluate nested condition to boolean
assertNull
assertNotNull
@actual is a variable name
or evaluate nested condition
assertEquals
assertNotEquals
Test actual is equal (or not equal) to expected.
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 used in combination with ignoreCase="auto"
@bitmask used in DOM Level 3 only. Tests: (actual & bitmask) equals (expectedResult & bitmask) where bitmask is an int
Alternatively, can include nested statement (presumably as a substitute to @actual), but can't see this is used anywhere.
assertSame
Tests two objects for identity.
If not, call assertEquals()
Don't really understand the point of this assert
(note about assertNull, assertNotNull, assertEquals, assertNotEquals, assertSame)
Alternatively, can include nested statement (presumably as a substitute to @actual), but can't see this is used anywhere.
assertInstanceOf
Used in [hc_]namednodemapreturnattrnode.xml
Can use Node.getNodeType() to get runtime type
assertSize
Tests a Java Collection has the specified size.
assertEventCount
(not used)
assertURIEquals
Compare pieces of the URI in @actual
@actual
@scheme
@path
@host
@file
@name
@query
@fragment
@isAbsolute boolean
assertImplementationException
DOM Level 2 Events dispatchEvent01.xml
assertDOMException
Tests that a DOMException is thrown with a specified code. Try/catching not nested.
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
(not used)
greater
greaterOrEquals
(not used)
isNull
(not used)
notNull
and
or
xor
(not used)
not
instanceOf
(not used)
isTrue
isFalse
hasSize
(not used)
contentType
contains
DOM Level 3 Core and LS only
hasFeature
calls DOMImplementation.hasFeature()
@feature quoted string e.g. "XML"
@version quoted string e.g. "1.0"
@value boolean
@var variable to assign the result to
@obj name of var holding the DOMImplementation
implementationAttribute
pass param to the test suite's DOMTestDocumentBuilderFactory (e.g. validating)
Statements
-------------------------------------------------------------------------------
var
Can contain nested elements when the var has type Collection
assign
increment
decrement
append
Append an object to the end of a Collection.
In Java, this is implemented with an ArrayList.
plus
subtract
mult
divide
load
if
while
try
Fail if reach the end of the try without throwing an exception specified in
...
...
No nesting in test cases, but sometimes more than one instance in a single test.
for-each
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
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
DOM Level 3 Core only
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
"ent1"
"ent2"
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