[Webtest] Re: WebTest fails on Petstore 2.0

Paul Beck Paul Beck" <pbeck@nearinfinity.com
Tue, 8 Jul 2008 20:39:13 -0400


------=_Part_19454_17415202.1215563953913
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Both options cause webtest to go into a loop with the statement that the
contents 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=Dogs#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=Dogs#canine01,101
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Content
of window changed to http://localhost:4867/petstore/faces/catalog
.jsp?catid=Dogs#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=Dogs#canine01,101
[clickElement]  INFO (com.canoo.webtest.engine.WebClientContext) - Content
of window changed to http://localhost:4867/petstore/faces/catalog
.jsp?catid=Dogs#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=Dogs#canine01,101

On Mon, Jul 7, 2008 at 8:29 AM, Soula, William <wsoula@pointserve.com>
wrote:

> 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: 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
>
> 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="//area[@onclick=&quot;browse('Dogs')&quot;]" />
>            <verifyText text="Beach Dog"/>
>            <clickElement
> xpath="//img[@src='/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 //img[@src="/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
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>

------=_Part_19454_17415202.1215563953913
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Both options cause webtest to go into a loop with the statement that the contents of the window have changed. See snippet below. This repeats over and over until cancelled or the timeout expires.<br><br>[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContext) - Content of window changed to <a href="http://localhost:4867/petstore/faces/catalog">http://localhost:4867/petstore/faces/catalog</a><br>
.jsp?catid=Dogs#canine01,101 (text/html)<br>[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContext) - Content of current window changed, it will become current response<br>[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContext) - Current form set to none<br>
[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContext) - Current response now: <a href="http://localhost:4867/petstore/faces/catalog.jsp?ca">http://localhost:4867/petstore/faces/catalog.jsp?ca</a><br>tid=Dogs#canine01,101<br>
[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContext) - Content of window changed to <a href="http://localhost:4867/petstore/faces/catalog">http://localhost:4867/petstore/faces/catalog</a><br>.jsp?catid=Dogs#canine01,101 (text/html)<br>
[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContext) - Content of current window changed, it will become current response<br>[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContext) - Current form set to none<br>
[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContext) - Current response now: <a href="http://localhost:4867/petstore/faces/catalog.jsp?ca">http://localhost:4867/petstore/faces/catalog.jsp?ca</a><br>tid=Dogs#canine01,101<br>
[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContext) - Content of window changed to <a href="http://localhost:4867/petstore/faces/catalog">http://localhost:4867/petstore/faces/catalog</a><br>.jsp?catid=Dogs#canine01,101 (text/html)<br>
[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContext) - Content of current window changed, it will become current response<br>[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContext) - Current form set to none<br>
[clickElement]&nbsp; INFO (com.canoo.webtest.engine.WebClientContext) - Current response now: <a href="http://localhost:4867/petstore/faces/catalog.jsp?ca">http://localhost:4867/petstore/faces/catalog.jsp?ca</a><br>tid=Dogs#canine01,101<br>
<br><div class="gmail_quote">On Mon, Jul 7, 2008 at 8:29 AM, Soula, William &lt;<a href="mailto:wsoula@pointserve.com">wsoula@pointserve.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Have you tried the easyajax config option (<a href="http://www.nabble.com/Ajax-Testing-to16051425.html#a16051885" target="_blank">http://www.nabble.com/Ajax-Testing-to16051425.html#a16051885</a>)? &nbsp;Or adding a sleep statement before the verifyText to wait for the text to appear. &nbsp;I think what is happening is that WebTest loads the page and then moves on to verifying the text but ajax hasn&#39;t finished loading the text.<br>

<div><div></div><div class="Wj3C7c"><br>
-----Original Message-----<br>
From: <a href="mailto:webtest-admin@lists.canoo.com">webtest-admin@lists.canoo.com</a> [mailto:<a href="mailto:webtest-admin@lists.canoo.com">webtest-admin@lists.canoo.com</a>] On Behalf Of Paul Beck<br>
Sent: Saturday, July 05, 2008 8:54 PM<br>
To: <a href="mailto:webtest@lists.canoo.com">webtest@lists.canoo.com</a><br>
Subject: [Webtest] WebTest fails on Petstore 2.0<br>
<br>
Hello,<br>
<br>
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&#39;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:<br>

<br>
&lt;project default=&quot;test&quot;&gt;<br>
<br>
 &nbsp; &nbsp;&lt;target name=&quot;test&quot;&gt;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;webtest name=&quot;check that petstore categories can be found by clicking images&quot;&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;invoke url=&quot;<a href="http://localhost:51492/petstore/faces/index.jsp" target="_blank">http://localhost:51492/petstore/faces/index.jsp</a>&quot;<br>
description=&quot;Go to Petstore 2.0&quot;/&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;verifyTitle text=&quot;Java Pet Store Reference Application&quot; /&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;clickElement<br>
xpath=&quot;//area[@onclick=&amp;quot;browse(&#39;Dogs&#39;)&amp;quot;]&quot; /&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;verifyText text=&quot;Beach Dog&quot;/&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;clickElement<br>
xpath=&quot;//img[@src=&#39;/petstore/images/banner_logo.gif&#39;]&quot; description=&quot;Main Page&quot; /&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;/webtest&gt;<br>
<br>
 &nbsp; &nbsp;&lt;/target&gt;<br>
&lt;/project&gt;<br>
<br>
It cannot find any text of the page. If I click on the failed step<br>
(verifyText) Page link, it displays a page with almost no text.<br>
<br>
What am I doing wrong?<br>
<br>
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 //img[@src=&quot;/petstore/images/dogs_icon.gif&quot;] in either Watir or Selenium. Also, the WebTest recorder recognizes this as a valid XPath expression but a &lt;verifyXPath /&gt; fails as does any use of it in a test.<br>

<br>
Am I missing something?<br>
<br>
Paul Beck<br>
<br>
<br>
<br>
<br>
</div></div>_______________________________________________<br>
WebTest mailing list<br>
<a href="mailto:WebTest@lists.canoo.com">WebTest@lists.canoo.com</a><br>
<a href="http://lists.canoo.com/mailman/listinfo/webtest" target="_blank">http://lists.canoo.com/mailman/listinfo/webtest</a><br>
</blockquote></div><br>

------=_Part_19454_17415202.1215563953913--