The webtest-maven-plugin allows running Canoo WebTests within a Maven 2 build but you might have guessed that already. Furthermore the plugin provides some additional syntactic sugar such as

  • run the tests in a loop
  • force a build error even when errors and failures are explictely ignored
  • check the result file for certain strings and fail if they exists

Plugin Installation

The plugin is not (yet) hosted at Codehaus so you need to download the plugin and install it mnanually using "mvn install".

Getting some examples

The hardest part is making the first successful steps when being new to Canoo Webtest and/or Maven. For some inspiration what you can do (e.g. JavaScript execution, embedding Groovy steps, testing PDF documents) check out the integration tests under ./src/test/itX

Using Canoo WebTest with M1

A M1 plugin is available at

Running tests in a loop

This is quite handy when you do load tests in parallel - in the background you run your webtests to ensure that the functional tests still work under high laod. The loop exits after a number of configurable iterations or when encountering the first problem.

Force a build error

A common problem with Continous Integration is the fact that you want run all tests and not stop after the first problem. Running all tests means also to finish the build (e.g. generating test reports) before you force a build failure - this is imlemented in webtest:verify-result .

Checking the result files

One common problem is when problems are disguised behind a HTTP 200 code, e.g. "An application error has occured". So if you fail to detect this magic messages in your test you have a problem while adding those checks to all tests makes them much harder to maintain. Therefore webtest:verify-filecontent is your friend.