[Webtest] WebTest looping on Petstore 2.0

Paul Beck Paul Beck <pbeck@nearinfinity.com>
Sun, 20 Jul 2008 21:01:06 -0400


Marc,

Sorry to be taking so long to respond. I've been preparing a comparison of
web testing tools for my company. Until this can be resolved, I have
recommended to our company that they do not use WebTest. This was a great
disappointment for me, as I had high hopes for WebTest. I have been unable
to find a way to get by this hurdle.

What I meant about WebTest going into a loop was explained in this post:

http://lists.canoo.com/pipermail/webtest/2008q3/010852.html

As you can see in the below snipped of the log, it keeps retrying the page
when it is updated by AJAX. It will continue this looping for the duration
of the sleep or the easyAjax config parameter timeout. This is run against
Petstore 2.0 from Sun's Blueprints website, running on Glassfish. Here is
the WebTest code.

<project default=3D"test">
    <target name=3D"test">
        <webtest name=3D"check that petstore categories can be found by
clicking images">
            <config port=3D"51492" basepath=3D"petstore" easyajax=3D"true"/>
            <steps>
                <invoke url=3D"/faces/index.jsp" description=3D"Go to Petstore
2.0"/>
                <verifyTitle text=3D"Java Pet Store Reference Application" />
                <verifyXPath
xpath=3D"//area[@onclick=3D&quot;browse('Dogs')&quot;]" />
                <clickElement
xpath=3D"//area[@onclick=3D&quot;browse('Dogs')&quot;]" />
                <sleep seconds=3D"10"/>
                <verifyText text=3D"Java Pet Store" />
                <verifyText text=3D"Beach Dog"/>
                <clickElement
xpath=3D"//img[@src=3D'/petstore/images/banner_logo.gif']" description=3D"Main
Page" />
            </steps>
        </webtest>
    </target>
</project>

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=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

Cheers,
Paul Beck

Message: 3
Date: Tue, 15 Jul 2008 09:23:21 +0200
From: Marc Guillemot <mguillemot@yahoo.fr>
To: webtest@lists.canoo.com
Subject: Re: [Webtest] Re: richFaces Ajax + content not updated (Keusch
Florian)
Reply-To: webtest@lists.canoo.com
Reply-To: Marc Guillemot <mguillemot@yahoo.fr>

XPath is very powerfull and verifyXPath allows to verify nearly
everything in your page.

You can surely add a sleep and it is possible to write a waitForElement
=E0 la Selenium but I think that it should not be necessary (ok, it's not
yet fully the case).

I don't understand what you mean with "WebTest will go into a loop".

Cheers,
Marc.