Re: DOML3 core test case questions

Neil Delima <[email protected]> Thu, 13 Nov 2003 19:15:31 -0500
Newsgroups gmane.comp.web.dom.test-suites.general
Message-ID <OF320C041A.50985066-ON85256DDD.005C807F-85256DDE.00019EDC@ca.ibm.com>




>>- Test cases for attributes Text.isElementContentWhitespace and
Attr.isId,
>>when transformed to java, appear to get inappropriately prefixed with a
>>"get".  Is there a fix for this?
>
>No, but I knew that this would need to be added since this was a change
>to the production rules.   The plan was to add a test and then fix the
>production.

Attached is a sample test for isElementContentWhitespace.  Hope it helps.
(See attached file: textiselementcontentwhitespace02.xml)


>Boolean.TRUE is way too much of a Java-ism.  Write it as expected="true"
>and I'll make sure the transform and infrastructure do the right thing.

Attached is a sample test case for getParameter.  A variable of type
DOMUserData
is being used to store and verify the returned value of this method.

(See attached file: domconfigurationgetparameter01.xml)


>There is no construct currently to do this.  If really necessary, we can
>add one.  Maybe something like:

Would be nice to have a construct like this.  Attached is a test that can
result in different DOMExceptions.

(See attached file: nodereplacechild01.xml)


>Do you have any plans to commit these tests?
Yes I plan to commit these, hopefully in the next few weeks.


Thanks for your help,
Neil.





                                                                                                                                       
                      Curt Arnold                                                                                                      
                      <carnold@houston.        To:       [email protected]                                                             
                      rr.com>                  cc:                                                                                     
                      Sent by:                 Subject:  Re: DOML3 core test case questions                                            
                      www-dom-ts-reques                                                                                                
                      [email protected]                                                                                                         
                                                                                                                                       
                                                                                                                                       
                      11/13/2003 12:36                                                                                                 
                      AM                                                                                                               
                                                                                                                                       




Neil Delima wrote:

>- Test cases for attributes Text.isElementContentWhitespace and Attr.isId,
>when transformed to java, appear to get inappropriately prefixed with a
>"get".  Is there a fix for this?
>
>
>
No, but I knew that this would need to be added since this was a change
to the production rules.   The plan was to add a test and then fix the
production.

>-  Does the test framework support testing methods that either return
>UserDataObject's or accept UserDataObject parameters.
>   For example to test getParameter(...) is something like following
valid?
>
><var name="doc" type="Document"/>
><var name="domConfig" type="DOMConfiguration"/>
><var name="param" type="Booelan"/> <!-- might case validation errors -->
><load var="doc" href="staffNS" willBeModified="false"/>
><domConfig obj="doc" var="domConfig" interface="Document"/>
><getParameter obj="domConfig" var="param" name='"comments"'/>
><assertEquals actual="param" expected='Boolean.TRUE' id="blah"/>  <!--
>again possible validation errors -->
>
>
>
Boolean.TRUE is way too much of a Java-ism.  Write it as expected="true"
and I'll make sure the transform and infrastructure do the right thing.

>- Is there any way of specifying more than one acceptable expected
>exception on a method?
>
>
>

There is no construct currently to do this.  If really necessary, we can
add one.  Maybe something like:

<assertDOMException>
     <AllowableCodes>
            <INDEX_SIZE_ERR/>
            <NO_MODIFICATION_ERR/>
     </AllowableCodes>
     <someStatement/>
</assertDOMException>


Do you have any plans to commit these tests?
textiselementcontentwhitespace02.xml (application/octet-stream, 1.7 KB)
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>

<!--

Copyright (c) 2001 World Wide Web Consortium, 
(Massachusetts Institute of Technology, Institut National de
Recherche en Informatique et en Automatique, Keio University).  All 
Rights Reserved.  This program is distributed under the W3C's Software
Intellectual Property License.  This program is distributed in the 
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.  

See W3C License http://www.w3.org/Consortium/Legal/ for more details.

-->

<!DOCTYPE test SYSTEM "dom3.dtd">
<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="textiselementcontentwhitespace02">
<metadata>
<title>textiselementcontentwhitespace02</title>
<creator>IBM</creator>
<description>
	The method isElementContentWhitespace returns whether this text node contains whitespace in element content.

	Invoke isElementContentWhitespace on a newly created Text Node that does not contain whitespace.  Verify if isElementContentWhitespace returns false.
</description>
<contributor>Neil Delima</contributor>
<date qualifier="created">2002-05-30</date>
<subject resource="http://www.w3.org/TR/DOM-Level-3-Core/core.html#Text3-isElementContentWhitespace"/>
</metadata>
<var name="doc" type="Document"/>
<var name="newText" type="Text"/>
<var name="hasWhitespace" type="boolean"/>
<load var="doc" href="staffNS" willBeModified="false"/>
<createTextNode var="newText" obj="doc" data='"NoWhiteSpace"'/>
<isElementContentWhitespace obj="newText" var="hasWhitespace"/>
<assertFalse actual="hasWhitespace" id="iselementcontentwhitespace02"/>
</test>
domconfigurationgetparameter01.xml (application/octet-stream, 1.6 KB)
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>
<!--

Copyright (c) 2001 World Wide Web Consortium, 
(Massachusetts Institute of Technology, Institut National de
Recherche en Informatique et en Automatique, Keio University).  All 
Rights Reserved.  This program is distributed under the W3C's Software
Intellectual Property License.  This program is distributed in the 
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.  

See W3C License http://www.w3.org/Consortium/Legal/ for more details.

-->

<!DOCTYPE test SYSTEM "dom3.dtd">
<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="domconfigurationgetparameter01">
<metadata>
<title>domconfigurationgetparameter01</title>
<creator>IBM</creator>
<description>
	The method getParameter returns the value of a parameter if known. 
	
	Get the DOMConfiguration object of a document and verify that the default required features are set
	to true.
</description>
<contributor>Jenny Hsu</contributor>
<date qualifier="created">2003-11-07</date>
<subject resource="http://www.w3.org/2003/09/WD-DOM-Level-3-Core-20030918/core.html#DOMConfiguration"/>
</metadata>
<var name="doc" type="Document"/>
<var name="domConfig" type="DOMConfiguration"/>
<var name="param" type="DOMUserData"/>
<load var="doc" href="staffNS" willBeModified="false"/>
<domConfig obj="doc" var="domConfig" interface="Document"/>
<getParameter obj="domConfig" var="param" name='"comments"'/>
<assertTrue actual="param" id="domconfigurationgetparameter01_1"/>
</test>
nodereplacechild01.xml (application/octet-stream, 2 KB)
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>

<!--

Copyright (c) 2001 World Wide Web Consortium, 
(Massachusetts Institute of Technology, Institut National de
Recherche en Informatique et en Automatique, Keio University).  All 
Rights Reserved.  This program is distributed under the W3C's Software
Intellectual Property License.  This program is distributed in the 
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.  

See W3C License http://www.w3.org/Consortium/Legal/ for more details.

-->

<!DOCTYPE test SYSTEM "dom3.dtd">
<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="nodereplacechild01">
<metadata>
<title>nodereplacechild01</title>
<creator>IBM</creator>
<description>
	The method replaceChild replaces the child node oldChild with newChild in the list of 
	children, and returns the oldChild node.

	Using replaceChild on this Document node attempt to replace this Document node with itslef
	and verify if a HIERARCHY_REQUEST_ERR error is thrown (or a NOT_FOUND_ERR since oldChild is 
	not a child of this node)
</description>
<contributor>Neil Delima</contributor>
<date qualifier="created">2003-06-10</date>
<subject resource="http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-785887307"/>
</metadata>
<implementationAttribute name="namespaceAware" value="true"/>
<var name="doc" type="Document"/>
<var name="replaced" type="Node"/>
<load var="doc" href="staffNS" willBeModified="false"/>
<assertDOMException id="HIERARCHY_REQUEST_ERR_nodereplacechild01">
<HIERARCHY_REQUEST_ERR>
<replaceChild obj="doc" var="replaced" oldChild="doc" newChild="doc"/>
</HIERARCHY_REQUEST_ERR>
</assertDOMException>
<!--
<assertDOMException>
     <AllowableCodes>
            <HIERARCHY_REQUEST_ERR/>
            <NOT_FOUND_ERR/>
     </AllowableCodes>
     <replaceChild obj="doc" var="replaced" oldChild="doc" newChild="doc"/>
</assertDOMException>
-->
</test>