Canoo Webtest WebTest Canoo

Core Step invoke


This step executes a request to a particular URL.

If the URL starts with a protocol (e.g. http://...) then the URL is treated is being fully qualified and invoked directly. Otherwise, the URL is treated as a relative suffix and the URL to invoke is determined from the settings specified with the config element, including port, protocol and basepath.

The result of the request is internally stored and its contents can be verified with one or more <verify...> steps. If the saveresponse option in the config element is enabled, the result (HTML source) will be written to a file for later viewing.

Note: If the URL contains an ampersand character (&), e.g. for parameter separation, it must be expressed using the XML element notion with "&amp;".


Required? yes
A complete URL or the 'relative' part of an URL which will be appended to the 'static' parts created from the configuration information defined with the <config> step.
Required? no
Form data in 'application/x-www-form-urlencoded' format, which will be sent in the body of a POST request. Ignored for GET requests. Only one of content and contentFile should be set.
Required? no
Filename to extract request contents from. Ignored for GET requests. Only one of content and contentFile should be set.
Required? no
The description of this test step.
Required? no, default is GET
Sets the HTTP Method, i.e. whether the invoke is a GET or POST.
Required? no
A password that can be provided for pages that require basic authentication. Required if username is specified.
Required? no
A shorthand: save='prefixName' is the same as savePrefix='prefixName' saveResponse='true'.
Required? no, default is the 'savePrefix' parameter as specified in <config>.
A name prefix can be specified for making a permanent copy of received responses. A unique number and the file extension (depending on the MIME-Type) will be appended. The resultpath attribute of the <config> element is used for determining the location of the saved result.
Required? no
Whether to make a permanent copy of received responses. Overrides the default value set in the <config> element.
Required? no
If the HTTP method is POST and is in fact a SOAP POST request, this allows the SOAP Action header to be set. Ignored for GETs.
Required? no
A username that can be provided for pages that require basic authentication. Typically only needed on the first step of any webtest accessing a secure site. Required if password is specified.

Inline Text

The inline text is all the text between the start tag ( <invoke> ) and the end tag ( </invoke> ), including blanks, tabs or newlines. Using a pair of start/end tags ( <invoke> </invoke> ) has not the same behavior than the seemingly equivalent empty element tag ( <invoke/> )! See this issue for an example.

Required? no
An alternative way to set the 'url' or the 'content' attribute. When the 'url' attribute is not specified the nested text is considered as the url value. Otherwise this is used to set the 'content' attribute for e.g. large content (properties get evaluated in this content).


Here is an example of a normal invoke:

<webtest name="Visit all pages without update">
  <config ... />
    <invoke  description="Start the main controller"

Here is an example of a SOAP invoke:

    <invoke method="POSTcontentFile="AustralianPostcodeByLocationRequest.xml"
    <verifyText text="Karalee"/>
    <verifyText text="QLD"/>
    <verifyText text="4306"/>

Note: the soapAction attribute is only needed for SOAP Web Service requests. For RESTful web services or to do an invoke of a tricky form normally submitted through JavaScript you can leave it out.

Here is what the AustralianPostcodeByLocationRequest.xml file contents might look like:


And the result might look something like:

<?xml version="1.0encoding="utf-8"?>
    &lt;PostCode&gt; QLD 4306&lt;/PostCode&gt;


Latest build: R_1826
Posted: 10-Dec-2014 10:23

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