Book Image

Apache Maven Cookbook

Book Image

Apache Maven Cookbook

Overview of this book

If you are a Java developer or a manager who has experience with Apache Maven and want to extend your knowledge, then this is the ideal book for you. Apache Maven Cookbook is for those who want to learn how Apache Maven can be used for build automation. It is also meant for those familiar with Apache Maven, but want to understand the finer nuances of Maven and solve specific problems.
Table of Contents (13 chapters)
12
Index

Using the Maven Failsafe plugin to run integration tests


In addition to unit tests, Maven also allows you to automate the running of your integration tests. While unit tests are run during the test phase of the build lifecycle, integration tests are run during the verify phase. The Maven Failsafe plugin is used to run integration tests.

How to do it...

To run integration tests using Maven Failsafe plugin, perform the following steps:

  1. Open a project containing integration tests, namely project-with-integration-test.

  2. Add the following plugin configuration to the pom file:

    <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-failsafe-plugin</artifactId>
       <version>2.18</version>
       <executions>
          <execution>
            <id>integration-tests</id>
            <goals>
               <goal>integration-test</goal>
               <goal>verify</goal>
            </goals>
          </execution...