Have you tried the easyajax config option 
(http://www.nabble.com/Ajax-Testing-to16051425.html#a16051885)?  Or adding a 
sleep statement before the verifyText to wait for the text to appear.  I think 
what is happening is that WebTest loads the page and then moves on to verifying 
the text but ajax hasn't finished loading the text.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Beck
Sent: Saturday, July 05, 2008 8:54 PM
To: [email protected]
Subject: [Webtest] WebTest fails on Petstore 2.0

Hello,

I am doing a comparison of various web application testing tools. WebTest 
appeared to be a strong contender from the documentation, however that turned 
out not to be the case in practice. I am using the Petstore 2.0 application 
from Sun's Blueprints as a basis for test, as this has a lot of AJAX stuff in 
it. Simple assertions fail as WebTest apparently does not see the text that is 
displayed via AJAX. Here is a trivial test which fails:

<project default="test">

    <target name="test">

        <webtest name="check that petstore categories can be found by clicking 
images">
            <invoke url="http://localhost:51492/petstore/faces/index.jsp";
description="Go to Petstore 2.0"/>
            <verifyTitle text="Java Pet Store Reference Application" />
            <clickElement
xpath="//[EMAIL PROTECTED]&quot;browse('Dogs')&quot;]" />
            <verifyText text="Beach Dog"/>
            <clickElement
xpath="//[EMAIL PROTECTED]'/petstore/images/banner_logo.gif']" 
description="Main Page" />
        </webtest>

    </target>
</project>

It cannot find any text of the page. If I click on the failed step
(verifyText) Page link, it displays a page with almost no text.

What am I doing wrong?

In addition, XPath expressions that work in Selenium-RC or Watir fail in 
WebTest. For example, on the home page for Petstore, the images on the left 
which are displayed as a dojo pick list can be accessed and clicked on via the 
XPath //[EMAIL PROTECTED]"/petstore/images/dogs_icon.gif"] in either Watir or 
Selenium. Also, the WebTest recorder recognizes this as a valid XPath 
expression but a <verifyXPath /> fails as does any use of it in a test.

Am I missing something?

Paul Beck




_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to