avy avy - 25 days ago 8
Java Question

how to run integration test-case for maven project

I have written a

maven project
.
I am using
junit
and
jmockit
to write unit-test and for mocking.

I want to write
Integration test
for the same project.

What
plugin
should i use and what
configuration
i need to do .

Thanks.

Answer

You can do like this

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <excludes>
      <exclude>**/*IntegrationTest.java</exclude>
    </excludes>
  </configuration>
  <executions>
    <execution>
      <id>integration-test</id>
      <goals>
        <goal>test</goal>
      </goals>
      <phase>integration-test</phase>
      <configuration>
        <excludes>
          <exclude>none</exclude>
        </excludes>
        <includes>
          <include>**/*IntegrationTest.java</include>
        </includes>
      </configuration>
    </execution>
  </executions>
</plugin>