【问题标题】:Is there a way to specify in Maven which JUnit tests run by package有没有办法在 Maven 中指定哪些 JUnit 测试由包运行
【发布时间】:2014-04-30 19:43:59
【问题描述】:

我想知道是否有一种方法可以在 Maven 中指定基于包名称运行的 JUnit 测试集合。 “排除”将是理想的,因为我不需要运行的数量少于需要运行的数量。

【问题讨论】:

标签: java maven junit maven-surefire-plugin


【解决方案1】:

是的,您可以将surefire插件配置为仅包含某些测试

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.17</version>
        <configuration>
          <includes>
            <include>com/abc/*Test.java</include>
          </includes>
        </configuration>
      </plugin>
    </plugins>
  </build>

http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html

【讨论】:

    猜你喜欢
    • 2016-07-27
    • 2021-12-16
    • 2019-04-25
    • 2011-10-17
    • 2011-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-02
    相关资源
    最近更新 更多