Skip to content

Instantly share code, notes, and snippets.

@mrts
Last active March 11, 2017 19:03
Show Gist options
  • Save mrts/1b749909164af0d3347980822f49645c to your computer and use it in GitHub Desktop.
Save mrts/1b749909164af0d3347980822f49645c to your computer and use it in GitHub Desktop.
Separate source locations for unit and integration tests in Maven pom.xml
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<id>add-integration-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/it/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
</plugin>
@mrts
Copy link
Author

mrts commented Mar 11, 2017

See https://vaadin.com/docs/-/part/testbench/testbench-tutorial.html how to start and stop Jetty automatically during integration test run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment