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: development
Posted: 19-Jul-2016 17:36

WebTest 3.0 released, featuring upgrades to Java 5, Groovy 1.6, and HtmlUnit 2.4.
The release includes support for maven integration, IDE-integration like for unit tests, capturing of background JavaScript errors, new steps for mouseOver and mouseOut events, better parallel execution of tests and - as usual - lots of handling improvements.
Posted: 5 March 2009

WebTest @ JavaOne
Dierk König presented "Functional testing of web applications: scaling with Java" on Wed May 7, 13:30 at JavaOne 2008 in the Tools and Scripting Languages track.
Posted: 8 May 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