Canoo Webtest WebTest Canoo

Extension Step retry

Description

This step encapsulates one or more test steps that should pass eventually but may fail initially. Any kind of step can be nested.

The actual repetition counter is made available to the steps included in the <retry> step by a special property. Its default name is "count" unless modified by the counterName attribute. This property can be referenced within(!) steps included in the <retry> step using this notation "#{count}" or the specified countername.

Parameters

maxcount
Required? yes
The number of times to try running the included steps. Counter values start at 0 and go up to count-1.
counterName
Required? no, default is count
The name that shall be used to reference the current repetition counter.
description
Required? no
The description of this test step.

Nested Parameters

step
Required? yes
A webtest step.

Details

The following example illustrates re-loading a page with a visit counter several times until a particular value is reached. A typical scenario would be to check that some asynchronous task has completed.

Retry Example
<webtest name="retry: illustrate RETRY of nested steps until they succeed">
    <config .../>
    <steps>
        <retry description="retry nested steps until the visit count is 3maxcount="10">
            <invoke description="Open page which increments visit counturl="visitCount.jsp"/>
            <sleep description="it is typically wise to include a sleepseconds="1"/>
            <verifyXPath description="confirm server-based counter is working - iteration #{count}"
                xpath="//p[@id='totalinfo']"
                text="This page has been accessed a total of 3 time(s)." />
        </retry>
    </steps>
</webtest>

If you are using XSLT reporting, you might expect to see something like:

news

Latest build: R_1705
Posted: 14-May-2008 13:13

WebTest @ JavaOne
Dierk König will present "Functional testing of web applications: scaling with Java" on Wed May 7, 13:30 at JavaOne in the Tools and Scripting Languages track.
Posted: 6 May 2008

WebTest 2.6 released, featuring upgrades to Ant 1.7, Groovy 1.5.4, and HtmlUnit 1.14.
The release includes support for data-driven testing, testing of drag-and-drop, advanced AJAX support, high-concurrency testing and reporting, real-time monitoring, and - as usual - lots of handling improvements.
Posted: 18 March 2008

New WebTest screencast available:
Data Driven WebTest
Posted: 13 November 2007

First WebTest screencast available:
Creating a first Webtest Project

Extend WebTest with Groovy! Groovy in Action is available in every good bookstore.
Groovy in Action
Posted: 29 January 2007