Docs

Documentation versions (currently viewingVaadin 7)

You are viewing documentation for an older Vaadin version. View latest documentation

Installing Vaadin TestBench

As with most Vaadin add-ons, you can install Vaadin TestBench as a Maven or Ivy dependency in your project, or from an installation package. The installation package contains some extra material, such as documentation, as well as the standalone library, which you use for testing in a grid.

The component element classes are Vaadin version specific and they are packaged in a vaadin-testbench-api library JAR, separately from the vaadin-testbench-core runtime library, which is needed for executing the tests.

Additionally, you may need to install drivers for the browsers you are using as described in Installing Browser Drivers.

Test Development Setup

In a typical test development setup, you develop tests in a Java project and run them on the development workstation. You can run the same tests in a dedicated test server, such as a continuous integration system.

In a test development setup, you do not need a grid hub or nodes. However, if you develop tests for a grid, you can run the tests, the grid hub, and one node all in your development workstation. A distributed setup is described later.

Maven Dependency

Add to the Vaadin TestBench dependency to your pom.xml. Remember to use the test scope as you don’t want the testing libraries to be deployed with your application.

<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-testbench</artifactId>
    <version>4.1.0.beta2</version>
    <scope>test</scope>
</dependency>

You also need to define the Vaadin add-ons repository if not already defined:

<repository>
   <id>vaadin-addons</id>
   <url>http://maven.vaadin.com/vaadin-addons</url>
</repository>

The vaadin-archetype-application archetype includes the repository declarations.

Ivy Dependency

The Ivy dependency, to be defined in ivy.xml, would be as follows:

<dependency org="com.vaadin" name="vaadin-testbench"
   rev="latest.release" conf="nodeploy->default"/>

The optional nodeploy->default configuration mapping requires a nodeploy configuration in the Ivy module; it is automatically created for new Vaadin projects.

A new Vaadin project created with the Vaadin Plugin for Eclipse includes the dependency.

Code Organization

We generally recommend developing tests in a project or module separate from the web application to be tested to avoid library problems. If the tests are part of the same project, you should at least arrange the source code and dependencies so that the test classes, the TestBench library, and their dependencies would not be deployed unnecessarily with the web application.

A Distributed Testing Environment

Vaadin TestBench supports distributed execution of tests in a grid. See "Running Tests in a Distributed Environment".

Installing Browser Drivers

Whether developing tests with the WebDriver in the workstation or running tests in a grid, using some browsers requires that a browser driver is installed.

  1. Download the latest browser driver

  2. Add the driver executable to user PATH. In a distributed testing environment, give it as a command-line parameter to the grid node service, as described in "Starting a Grid Node".