Webtest WebTest GitHub Home

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: