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

Java 如何为maven项目运行集成测试用例,java,maven,junit,integration-testing,jmockit,Java,Maven,Junit,Integration Testing,Jmockit,我写了一个maven项目。 我使用junit和jmockit来编写单元测试和模拟 我想为同一个项目编写集成测试 我应该使用什么插件,需要做什么配置 谢谢 你可以这样做 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <

我写了一个maven项目。 我使用junit和jmockit来编写单元测试和模拟

我想为同一个项目编写集成测试

我应该使用什么插件,需要做什么配置

谢谢

你可以这样做

<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>
你可以这样做

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

浏览链接感谢它的帮助:浏览链接感谢它的帮助: