[Webtest] RE: WebTest fails on Petstore 2.0

Soula, William Soula, William" <wsoula@pointserve.com
Mon, 7 Jul 2008 07:29:00 -0500

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

-----Original Message-----
From: webtest-admin@lists.canoo.com [mailto:webtest-admin@lists.canoo.com] =
On Behalf Of Paul Beck
Sent: Saturday, July 05, 2008 8:54 PM
To: webtest@lists.canoo.com
Subject: [Webtest] WebTest fails on Petstore 2.0


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

<project default=3D"test">

    <target name=3D"test">

        <webtest name=3D"check that petstore categories can be found by cli=
cking images">
            <invoke url=3D"http://localhost:51492/petstore/faces/index.jsp"
description=3D"Go to Petstore 2.0"/>
            <verifyTitle text=3D"Java Pet Store Reference Application" />
xpath=3D"//area[@onclick=3D&quot;browse('Dogs')&quot;]" />
            <verifyText text=3D"Beach Dog"/>
xpath=3D"//img[@src=3D'/petstore/images/banner_logo.gif']" description=3D"M=
ain Page" />


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 We=
bTest. For example, on the home page for Petstore, the images on the left w=
hich are displayed as a dojo pick list can be accessed and clicked on via t=
he XPath //img[@src=3D"/petstore/images/dogs_icon.gif"] in either Watir or =
Selenium. Also, the WebTest recorder recognizes this as a valid XPath expre=
ssion but a <verifyXPath /> fails as does any use of it in a test.

Am I missing something?

Paul Beck

WebTest mailing list