Selenium-RC server jar is required for the tests to be run. You can get it with the dependency-maven-plugin, for instance.
<project> ... <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>dependency-maven-plugin</artifactId> <executions> <execution> <id>copy</id> <phase>process-resources</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.openqa.selenium.server</groupId> <artifactId>selenium-server</artifactId> <version>0.8.1</version> <type>jar</type> <outputDirectory>${project.build.directory}</outputDirectory> <destFileName>selenium-server.jar</destFileName> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin>
Then, configure the mavenium plugin (0.1 version, for instance):
<project> ... <plugin> <groupId>com.agilepirates</groupId> <artifactId>mavenium</artifactId> <version>0.1</version> <executions> <execution> <goals> <goal>launch-selenium</goal> <goal>validate-selenium-tests</goal> </goals> </execution> </executions> </plugin>
As you can see, two goals are specified: launch-selenium, which is bound to the integration-test phase and validate-selenium-tests, which is bound to post-integration-test.
If the latest plugin version is not yet available from Maven's Central Repository you can download it and install it with this simple command (for 0.1 version):
mvn install:install-file -DgroupId=com.agilepirates -DartifactId=mavenium \ -Dversion=0.1 -Dpackaging=maven-plugin -Dfile=/path/to/file
What these two goals binding means is that mavenium expects your webapp to be deployed in the server of your choice at the integration-test phase. I encourage you to use the maven cargo plugin available at the cargo web site to do so. It would look similar to this:
<project> ... <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <configuration> <wait>false</wait> <container> <containerId>${cargo.container.id}</containerId> <zipUrlInstaller> <url>${cargo.container.url}</url> <installDir> ${cargo.container.dir} </installDir> </zipUrlInstaller> </container> <configuration> <properties> <cargo.servlet.port> ${cargo.container.port} </cargo.servlet.port> </properties> </configuration> </configuration> <executions> <execution> <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> </execution> <execution> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin>
Finally, I personally use the plugin within a specific profile activated with a property called "testit", executing maven with something like this:
mvn verify -Dtestit
If every test works fine you should see something like this in your maven's execution output:
------------------------------------------------------- T E S T S ------------------------------------------------------- Tests run: 3, Failures: 0 [INFO] Tests PASSED :)
Otherwise, the build will fail, and you'll see this kind of message:
------------------------------------------------------- T E S T S ------------------------------------------------------- Tests run: 2, Failures: 1 [INFO] Tests FAILED :(
You can see here a list of the parameters available for the plugin.