如何 运行 maven 项目的集成测试用例

how to run integration test-case for maven project

我写了一篇maven project。 我正在使用 junitjmockit 来编写单元测试和模拟。

我想为同一个项目写Integration test

我应该使用什么plugin以及我需要做什么configuration

谢谢。

你可以这样做

<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>