Canoo Webtest WebTest Canoo

Extension Step dataDriven

Description

This is an Ant task that calls its nested element as often as specified by the tableContainer. In each run a new set of properties from the the tableContainer is made available to the nested steps

This is the integration into WebTest of the propertyTable task that is available since a long time in WebTest Wiki. You may find usefull to look at this documation because it is currently more complete than this current page.

Parameters

tableContainer
Required? yes
The container for the table containing the data. Typically this is the path to an Excel file but this can also be a directory structure.
description
Required? no
The description of this test step.
failASAP
Required? no, default is false
Indicates if the task should fail at the first failure of the nested content (when set to true) or continue the execution for all records and then throw a BuildException when one or more error occurred (when set to false).
filterclass
Required? no, default is FirstEquals
The filter to apply on the foreign table after the lookup. One of "All", "Empty", "FirstEquals", "AllEquals" or "Group".
replaceProperties
Required? no, default is no
Specifies whether properties contained in the table's values should be expanded or not
table
Required? no, default is the first table
The name of the source table in the current container. For instance the name of the sheet when the table container is an Excel document.

Nested Parameters

task
Required? yes
Any Ant task.

Details

Imagine an Excel file like this one:



You can use dataDriven to execute a set of Ant tasks for each property set:

dataDrivenEcho.xml
<dataDriven tableContainer="simple.xls">
  <echo message="Hello ${FirstName} ${LastName}"/>
</dataDriven>

This will give you following output:

[echo] Hello Denis N. Antonioli
[echo] Hello Dierk König
[echo] Hello Marc Guillemot
[echo] Hello Paul King
[echo] Hello Tomi Schütz

Naturally you can combine it with WebTest, lets say to register these persons to some event:

dataDrivenWebtetst.xml
<dataDriven tableContainer="simple.xls">
  <webtest name="Register ${FirstName} ${LastName}">
    ... go to registration page ...
    <setInputField forLabel="First namevalue="${FirstName}"/>
    <setInputField forLabel="Last namevalue="${LastName}"/>
    <clickButton label="Register"/>
    <verifyText text="${FirstName} ${LastName} has been registered"/>
  </webtest>
</dataDriven>

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