[Webtest] FW: WebTest fails on Petstore 2.0

Soula, William Soula, William" <wsoula@pointserve.com
Wed, 9 Jul 2008 08:48:55 -0500


--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB1844F45841SGPEXCHANGEpo_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

forwarding because it did not make it to the mailing list

________________________________
From: Paul Beck [mailto:pbeck@nearinfinity.com]
Sent: Tuesday, July 08, 2008 7:39 PM
To: Soula, William
Cc: webtest@lists.canoo.com
Subject: Re: WebTest fails on Petstore 2.0

Both options cause webtest to go into a loop with the statement that the co=
ntents of the window have changed. See snippet below. This repeats over and=
 over until cancelled or the timeout expires.

[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Content =
of window changed to http://localhost:4867/petstore/faces/catalog
.jsp?catid=3DDogs#canine01,101 (text/html)
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Content =
of current window changed, it will become current response
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Current =
form set to none
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Current =
response now: http://localhost:4867/petstore/faces/catalog.jsp?ca
tid=3DDogs#canine01,101
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Content =
of window changed to http://localhost:4867/petstore/faces/catalog
.jsp?catid=3DDogs#canine01,101 (text/html)
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Content =
of current window changed, it will become current response
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Current =
form set to none
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Current =
response now: http://localhost:4867/petstore/faces/catalog.jsp?ca
tid=3DDogs#canine01,101
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Content =
of window changed to http://localhost:4867/petstore/faces/catalog
.jsp?catid=3DDogs#canine01,101 (text/html)
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Content =
of current window changed, it will become current response
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Current =
form set to none
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Current =
response now: http://localhost:4867/petstore/faces/catalog.jsp?ca
tid=3DDogs#canine01,101

On Mon, Jul 7, 2008 at 8:29 AM, Soula, William <wsoula@pointserve.com<mailt=
o:wsoula@pointserve.com>> wrote:
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> [=
mailto: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<mailto:webtest@lists.canoo.com>
Subject: [Webtest] WebTest fails on Petstore 2.0

Hello,

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 clic=
king 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" />
           <clickElement
xpath=3D"//area[@onclick=3D&quot;browse('Dogs')&quot;]" />
           <verifyText text=3D"Beach Dog"/>
           <clickElement
xpath=3D"//img[@src=3D'/petstore/images/banner_logo.gif']" description=3D"M=
ain 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 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
WebTest@lists.canoo.com<mailto:WebTest@lists.canoo.com>
http://lists.canoo.com/mailman/listinfo/webtest


--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB1844F45841SGPEXCHANGEpo_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.6000.16674" name=3DGENERATOR></HEAD>
<BODY>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff size=3D2><SP=
AN=20
class=3D289004813-09072008>forwarding because it did not make it to the mai=
ling=20
list</SPAN></FONT></DIV><BR>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> Paul Beck [mailto:pbeck@nearinfin=
ity.com]=20
<BR><B>Sent:</B> Tuesday, July 08, 2008 7:39 PM<BR><B>To:</B> Soula,=20
William<BR><B>Cc:</B> webtest@lists.canoo.com<BR><B>Subject:</B> Re: WebTes=
t=20
fails on Petstore 2.0<BR></FONT><BR></DIV>
<DIV></DIV>Both options cause webtest to go into a loop with the statement =
that=20
the contents of the window have changed. See snippet below. This repeats ov=
er=20
and over until cancelled or the timeout expires.<BR><BR>[clickElement]&nbsp=
;=20
INFO (com.canoo.webtest.engine.WebClientContext) - Content of window change=
d to=20
<A=20
href=3D"http://localhost:4867/petstore/faces/catalog">http://localhost:4867=
/petstore/faces/catalog</A><BR>.jsp?catid=3DDogs#canine01,101=20
(text/html)<BR>[clickElement]&nbsp; INFO=20
(com.canoo.webtest.engine.WebClientContext) - Content of current window cha=
nged,=20
it will become current response<BR>[clickElement]&nbsp; INFO=20
(com.canoo.webtest.engine.WebClientContext) - Current form set to=20
none<BR>[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContex=
t) -=20
Current response now: <A=20
href=3D"http://localhost:4867/petstore/faces/catalog.jsp?ca">http://localho=
st:4867/petstore/faces/catalog.jsp?ca</A><BR>tid=3DDogs#canine01,101<BR>[cl=
ickElement]&nbsp;=20
INFO (com.canoo.webtest.engine.WebClientContext) - Content of window change=
d to=20
<A=20
href=3D"http://localhost:4867/petstore/faces/catalog">http://localhost:4867=
/petstore/faces/catalog</A><BR>.jsp?catid=3DDogs#canine01,101=20
(text/html)<BR>[clickElement]&nbsp; INFO=20
(com.canoo.webtest.engine.WebClientContext) - Content of current window cha=
nged,=20
it will become current response<BR>[clickElement]&nbsp; INFO=20
(com.canoo.webtest.engine.WebClientContext) - Current form set to=20
none<BR>[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContex=
t) -=20
Current response now: <A=20
href=3D"http://localhost:4867/petstore/faces/catalog.jsp?ca">http://localho=
st:4867/petstore/faces/catalog.jsp?ca</A><BR>tid=3DDogs#canine01,101<BR>[cl=
ickElement]&nbsp;=20
INFO (com.canoo.webtest.engine.WebClientContext) - Content of window change=
d to=20
<A=20
href=3D"http://localhost:4867/petstore/faces/catalog">http://localhost:4867=
/petstore/faces/catalog</A><BR>.jsp?catid=3DDogs#canine01,101=20
(text/html)<BR>[clickElement]&nbsp; INFO=20
(com.canoo.webtest.engine.WebClientContext) - Content of current window cha=
nged,=20
it will become current response<BR>[clickElement]&nbsp; INFO=20
(com.canoo.webtest.engine.WebClientContext) - Current form set to=20
none<BR>[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContex=
t) -=20
Current response now: <A=20
href=3D"http://localhost:4867/petstore/faces/catalog.jsp?ca">http://localho=
st:4867/petstore/faces/catalog.jsp?ca</A><BR>tid=3DDogs#canine01,101<BR><BR=
>
<DIV class=3Dgmail_quote>On Mon, Jul 7, 2008 at 8:29 AM, Soula, William &lt=
;<A=20
href=3D"mailto:wsoula@pointserve.com">wsoula@pointserve.com</A>&gt; wrote:<=
BR>
<BLOCKQUOTE class=3Dgmail_quote=20
style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204=
,204,204) 1px solid">Have=20
  you tried the easyajax config option (<A=20
  href=3D"http://www.nabble.com/Ajax-Testing-to16051425.html#a16051885"=20
  target=3D_blank>http://www.nabble.com/Ajax-Testing-to16051425.html#a16051=
885</A>)?=20
  &nbsp;Or adding a sleep statement before the verifyText to wait for the t=
ext=20
  to appear. &nbsp;I think what is happening is that WebTest loads the page=
 and=20
  then moves on to verifying the text but ajax hasn't finished loading the=
=20
  text.<BR>
  <DIV>
  <DIV></DIV>
  <DIV class=3DWj3C7c><BR>-----Original Message-----<BR>From: <A=20
  href=3D"mailto:webtest-admin@lists.canoo.com">webtest-admin@lists.canoo.c=
om</A>=20
  [mailto:<A=20
  href=3D"mailto:webtest-admin@lists.canoo.com">webtest-admin@lists.canoo.c=
om</A>]=20
  On Behalf Of Paul Beck<BR>Sent: Saturday, July 05, 2008 8:54 PM<BR>To: <A=
=20
  href=3D"mailto:webtest@lists.canoo.com">webtest@lists.canoo.com</A><BR>Su=
bject:=20
  [Webtest] WebTest fails on Petstore 2.0<BR><BR>Hello,<BR><BR>I am doing a=
=20
  comparison of various web application testing tools. WebTest appeared to =
be a=20
  strong contender from the documentation, however that turned out not to b=
e the=20
  case in practice. I am using the Petstore 2.0 application from Sun's=20
  Blueprints as a basis for test, as this has a lot of AJAX stuff in it. Si=
mple=20
  assertions fail as WebTest apparently does not see the text that is displ=
ayed=20
  via AJAX. Here is a trivial test which fails:<BR><BR>&lt;project=20
  default=3D"test"&gt;<BR><BR>&nbsp; &nbsp;&lt;target=20
  name=3D"test"&gt;<BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;&lt;webtest name=3D"c=
heck that=20
  petstore categories can be found by clicking images"&gt;<BR>&nbsp; &nbsp;=
=20
  &nbsp; &nbsp; &nbsp; &nbsp;&lt;invoke url=3D"<A=20
  href=3D"http://localhost:51492/petstore/faces/index.jsp"=20
  target=3D_blank>http://localhost:51492/petstore/faces/index.jsp</A>"<BR>d=
escription=3D"Go=20
  to Petstore 2.0"/&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
  &nbsp;&lt;verifyTitle text=3D"Java Pet Store Reference Application"=20
  /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
  &nbsp;&lt;clickElement<BR>xpath=3D"//area[@onclick=3D&amp;quot;browse('Do=
gs')&amp;quot;]"=20
  /&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;verifyText text=3D"=
Beach=20
  Dog"/&gt;<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=20
  &nbsp;&lt;clickElement<BR>xpath=3D"//img[@src=3D'/petstore/images/banner_=
logo.gif']"=20
  description=3D"Main Page" /&gt;<BR>&nbsp; &nbsp; &nbsp;=20
  &nbsp;&lt;/webtest&gt;<BR><BR>&nbsp;=20
  &nbsp;&lt;/target&gt;<BR>&lt;/project&gt;<BR><BR>It cannot find any text =
of=20
  the page. If I click on the failed step<BR>(verifyText) Page link, it dis=
plays=20
  a page with almost no text.<BR><BR>What am I doing wrong?<BR><BR>In addit=
ion,=20
  XPath expressions that work in Selenium-RC or Watir fail in WebTest. For=
=20
  example, on the home page for Petstore, the images on the left which are=
=20
  displayed as a dojo pick list can be accessed and clicked on via the XPat=
h=20
  //img[@src=3D"/petstore/images/dogs_icon.gif"] in either Watir or Seleniu=
m.=20
  Also, the WebTest recorder recognizes this as a valid XPath expression bu=
t a=20
  &lt;verifyXPath /&gt; fails as does any use of it in a test.<BR><BR>Am I=
=20
  missing something?<BR><BR>Paul=20
  Beck<BR><BR><BR><BR><BR></DIV></DIV>_____________________________________=
__________<BR>WebTest=20
  mailing list<BR><A=20
  href=3D"mailto:WebTest@lists.canoo.com">WebTest@lists.canoo.com</A><BR><A=
=20
  href=3D"http://lists.canoo.com/mailman/listinfo/webtest"=20
  target=3D_blank>http://lists.canoo.com/mailman/listinfo/webtest</A><BR></=
BLOCKQUOTE></DIV><BR></BODY></HTML>

--_000_93B3B6122B906D44BC7E8B8CEFB0DBBB1844F45841SGPEXCHANGEpo_--