Some feedback on the DOM level 1 core tests

Would it be a good idea to combine multiple tests into one class, instead of
using a separate class for each test? This would reduce the huge number of
classes that are generated at the moment, making the test suite more
manageable and improving performance as well. The original NIST test suite
has 15 classes (one for each interface), which is a lot easier than the 250+
classes we have now.

In tests characterdataappenddatanomodificationallowederr.xml,
characterdatadeletedatanomodificationallowederr.xml,
characterdatainsertdatanomodificationallowederr.xml, and
characterdatareplacedatanomodificationallowederr.xml the tagname in the
following statement should probably be "gender":
<getElementsByTagName interface="Document" obj="doc"
tagname="&quot;geneder&quot;" var="genderList"/>

For tests characterdataappenddatanomodificationallowederr.xml,
characterdatadeletedatanomodificationallowederr.xml,
characterdatainsertdatanomodificationallowederr.xml,
characterdatareplacedatanomodificationallowederr.xml, and
characterdatasetdatanomodificationallowederr.xml the comment tells that the
third gender element should contain an entity reference, but this is not the
case in the older version of the staff.xml document.

In documentcreateentityreferenceknown.xml, the type of newEntRefNode should
probably be EntityReference (instead of Element):
<var name="newEntRefNode" type="Element"/>

Several tests seem to test equivalence of two lists where one list contains
a String and the other contains an Integer. Some tests also try to assert
null values of nodes with a String value of "null" in a list, maybe it's
better to use assertNull. Since I don't have access to the cvs server (but
who has ;-), could somebody fix these issues?

- Test characterdatadeletedatagetlengthanddata.xml (fixed String/Integer,
removed lists):
<var name="doc" type="Document"/>
<var name="elementList" type="NodeList"/>
<var name="nameNode" type="Node"/>
<var name="child" type="CharacterData"/>
<var name="childData" type="DOMString"/>
<var name="childLength" type="int"/>
<load var="doc" href="staff.xml" willBeModified="true"/>
<getElementsByTagName interface="Document" obj="doc"
tagname="&quot;address&quot;" var="elementList"/>
<item interface="NodeList" obj="elementList" index="0" var="nameNode"/>
<firstChild obj="nameNode" var="child"/>
<deleteData obj="child" offset="30" count="5"/>
<data interface="CharacterData" obj="child" var="childData"/>
<assertEquals actual="childData" expected="&quot;1230 North Ave. Dallas,
Texas &quot;" id="characterdataDeleteDataGetLengthAndDataAssert1"
ignoreCase="false"/>
<length interface="CharacterData" obj="child" var="childLength"/>
<assertEquals actual="childLength" expected="30"
id="characterdataDeleteDataGetLengthAndDataAssert2"/>

- Test documentcreateattribute.xml (fixed String/Integer, removed lists):
<var name="doc" type="Document"/>
<var name="newAttrNode" type="Attr"/>
<var name="attrValue" type="DOMString"/>
<var name="attrName" type="DOMString"/>
<var name="attrType" type="int"/>
<load var="doc" href="staff.xml" willBeModified="false"/>
<createAttribute obj="doc" var="newAttrNode" name="&quot;district&quot;"/>
<nodeValue obj="newAttrNode" var="attrValue"/>
<assertEquals actual="attrValue" expected="&quot;&quot;" id="nodeValue"
ignoreCase="false"/>
<nodeName obj="newAttrNode" var="attrName"/>
<assertEquals actual="attrName" expected="&quot;district&quot;"
id="nodeName" ignoreCase="false"/>
<nodeType obj="newAttrNode" var="attrType"/>
<assertEquals actual="attrType" expected="2" id="nodeType"/>

- Test documentcreatecomment.xml (fixed String/Integer, removed lists):
<var name="doc" type="Document"/>
<var name="newCommentNode" type="Comment"/>
<var name="newCommentValue" type="DOMString"/>
<var name="newCommentName" type="DOMString"/>
<var name="newCommentType" type="int"/>
<load var="doc" href="staff.xml" willBeModified="false"/>
<createComment obj="doc" var="newCommentNode" data="&quot;This is a new
Comment node&quot;"/>
<nodeValue obj="newCommentNode" var="newCommentValue"/>
<assertEquals actual="newCommentValue" expected="&quot;This is a new Comment
node&quot;" id="nodeValue" ignoreCase="false"/>
<nodeName obj="newCommentNode" var="newCommentName"/>
<assertEquals actual="newCommentName" expected="&quot;#comment&quot;"
id="nodeName" ignoreCase="false"/>
<nodeType obj="newCommentNode" var="newCommentType"/>
<assertEquals actual="newCommentType" expected="8" id="nodeType"/>

- Test documentcreatedocumentfragment (fixed String/Integer, assertNull for
nodeValue, removed lists):
<var name="doc" type="Document"/>
<var name="newDocFragment" type="DocumentFragment"/>
<var name="children" type="NodeList"/>
<var name="length" type="int"/>
<var name="newDocFragmentName" type="DOMString"/>
<var name="newDocFragmentType" type="int"/>
<var name="newDocFragmentValue" type="DOMString"/>
<load var="doc" href="staff.xml" willBeModified="false"/>
<createDocumentFragment obj="doc" var="newDocFragment"/>
<childNodes obj="newDocFragment" var="children"/>
<length interface="NodeList" obj="children" var="length"/>
<assertEquals actual="length" expected="0" id="lengthZero"/>
<nodeName obj="newDocFragment" var="newDocFragmentName"/>
<assertEquals actual="newDocFragmentName"
expected="&quot;#document-fragment&quot;" id="nodeName" ignoreCase="false"/>
<nodeType obj="newDocFragment" var="newDocFragmentType"/>
<assertEquals actual="newDocFragmentType" expected="11" id="nodeType"/>
<nodeValue obj="newDocFragment" var="newDocFragmentValue"/>
<assertNull actual="newDocFragmentValue" id="nodeValue"/>

- Test documentcreateelement (fixed String/Integer, assertNull for
nodeValue, removed lists):
<var name="doc" type="Document"/>
<var name="newElement" type="Element"/>
<var name="newElementName" type="DOMString"/>
<var name="newElementType" type="int"/>
<var name="newElementValue" type="DOMString"/>
<load var="doc" href="staff.xml" willBeModified="false"/>
<createElement obj="doc" var="newElement" tagName="&quot;address&quot;"/>
<nodeName obj="newElement" var="newElementName"/>
<assertEquals actual="newElementName" expected="&quot;address&quot;"
id="nodeName" ignoreCase="false"/>
<nodeType obj="newElement" var="newElementType"/>
<assertEquals actual="newElementType" expected="1" id="nodeType"/>
<nodeValue obj="newElement" var="newElementValue"/>
<assertNull actual="newElementValue" id="nodeValue"/>

- Test documentcreateentityreference (fixed String/Integer, assertNull for
nodeValue, removed lists):
<var name="doc" type="Document"/>
<var name="newEntRefNode" type="EntityReference"/>
<var name="entRefValue" type="DOMString"/>
<var name="entRefName" type="DOMString"/>
<var name="entRefType" type="int"/>
<load var="doc" href="staff.xml" willBeModified="false"/>
<createEntityReference obj="doc" var="newEntRefNode"
name="&quot;ent1&quot;"/>
<nodeName obj="newEntRefNode" var="entRefName"/>
<assertEquals actual="entRefName" expected="&quot;ent1&quot;" id="nodeName"
ignoreCase="false"/>
<nodeType obj="newEntRefNode" var="entRefType"/>
<assertEquals actual="entRefType" expected="5" id="nodeType"/>
<nodeValue obj="newEntRefNode" var="entRefValue"/>
<assertNull actual="entRefValue" id="nodeValue"/>

- Test documentcreateprocessinginstruction (fixed String/Integer, removed
lists):
<var name="doc" type="Document"/>
<var name="newPINode" type="ProcessingInstruction"/>
<var name="piValue" type="DOMString"/>
<var name="piName" type="DOMString"/>
<var name="piType" type="int"/>
<load var="doc" href="staff.xml" willBeModified="false"/>
<createProcessingInstruction obj="doc" var="newPINode"
target="&quot;XML&quot;" data="&quot;This is a new PI node&quot;"/>
<nodeValue obj="newPINode" var="piValue"/>
<assertEquals actual="piValue" expected="&quot;This is a new PI node&quot;"
id="nodeValue" ignoreCase="false"/>
<nodeName obj="newPINode" var="piName"/>
<assertEquals actual="piName" expected="&quot;XML&quot;" id="nodeValue"
ignoreCase="false"/>
<nodeType obj="newPINode" var="piType"/>
<assertEquals actual="piType" expected="7" id="nodeType"/>

- Test documentcreatetextnode (fixed String/Integer, removed lists):
<var name="doc" type="Document"/>
<var name="newTextNode" type="Text"/>
<var name="newTextValue" type="DOMString"/>
<var name="newTextName" type="DOMString"/>
<var name="newTextType" type="int"/>
<load var="doc" href="staff.xml" willBeModified="false"/>
<createTextNode obj="doc" var="newTextNode" data="&quot;This is a new Text
node&quot;"/>
<nodeValue obj="newTextNode" var="newTextValue"/>
<assertEquals actual="newTextValue" expected="&quot;This is a new Text
node&quot;" id="nodeValue" ignoreCase="false"/>
<nodeName obj="newTextNode" var="newTextName"/>
<assertEquals actual="newTextName" expected="&quot;#text&quot;"
id="nodeName" ignoreCase="false"/>
<nodeType obj="newTextNode" var="newTextType"/>
<assertEquals actual="newTextType" expected="3" id="nodeType"/>

---
Freek

Received on Tuesday, 21 August 2001 10:47:23 UTC