[Webtest] AJAX (DWR) webtest Compatability

Marc Guillemot webtest@lists.canoo.com
Wed, 12 Oct 2005 13:38:01 +0200


Hi,

can you give a try to the latest build. It contains the latest htmlunit 
from CVS with some improvements concerning XMLHttpRequest. Perhaps does 
it already solve the problem. If not, this is easier to track it down.

Marc.

Simon Gibson wrote:
> Hi,
> 
> 
> I am experimenting with Canoo webtest and validating it for a current
> project. So far it has seemed pretty close to our requirements until
> we hit a problem where some of the pages use AJAX (implementation from
> DWR). The particular page has a drop down that when clicked populates
> some text fields. It seems to be being clicked but falls over in the
> javascript calls for AJAX.
> 
> 
> Has anyone had any experience with webtest and DWR?
> 
> 
> Below are some code snippets showing the error, but essentially I
> would just like to know whether anybody has used AJAX and webtest
> together.
> 
> 
> Cheers
> 
> 
> Simon
> 
> 
> <project>
> 
>   <target>
> 
>     <testSpec>
> 
>       <steps>
> 
>              <!Initial steps cut for brevity -->
> 
> 
> 
> 
> 
>          <verifyTitle description="verify add edit news page"
> 
>                       text="Add/Edit News" />
> 
>          <setSelectField description="Select a news item"
> 
>                          name="articleDropDown"
> 
>                          optionIndex="1" />
> 
>          <verifyText description="verify something was clicked in add edit news"
> 
>                      text="The text" />
> 
> 
> 
>       </steps>
> 
>     </testSpec>
> 
>   </target>
> 
> </project>
> 
> 
> 
> 
> 
> --------------------------------------snip------------------------------------------------------------
> 
> [testSpec] (steps.Step                          239 ) Start Step:
> setSelectField "Select a news item" (14/16)
> 
>  [testSpec] (engine.Context                      347 ) Current form
> set to (action=/project/AddEditNews.do)
> 
>  [testSpec] 10-Oct-2005 14:24:39
> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest
> jsxFunction_open
> 
>  [testSpec] SEVERE: Unable to initialize XMLHttpRequest using
> malformed URL '/project/dwr/exec/AddEditNews.getNewsItem'.
> 
>  [testSpec] Exception in thread "XMLHttpRequest.send() Thread"
> java.lang.NullPointerException
> 
>  [testSpec]     at
> com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest$1.run(XMLHttpRequest.java:296)
> 
>  [testSpec] (steps.Step                          239 ) Start Step:
> verifyText "verify something was clicked in addedit news" (15/16)
> 
>  [testSpec] (steps.Step                          440 ) Exception
> thrown from this class: com.canoo.webtest.engine.StepFailedException
> 
>  [testSpec] (steps.Step                          442 ) Message was:
> Step[verifyText "verify something was clicked in add edit news"
> (15/16)]: Text not found in page. Expected <The text>
> 
> 
> 
> BUILD FAILED
> 
> Test step verifyText (T:\doc\technical\usefulbox\simple.xml:56: ) 
> named "verify something was clicked in add edit
> 
> news" failed with message "Step[verifyText "verify something was
> clicked in add edit news" (15/16)]: Text not found
> 
>  in page. Expected <The text>"
> Yzfj)b	b՞m7Xhm+-Ƨ(Ybا~y^st==