【问题标题】:How to split JUnit Tests in a Jenkins如何在 Jenkins 中拆分 JUnit 测试
【发布时间】:2020-10-11 03:57:33
【问题描述】:

我正在尝试使用 Jenkins 的 Junit 类别来拆分我的测试。我在线阅读了所有指南并执行了以下操作。

  1. 创建了一个界面
public interface regression {}

  1. 为测试添加了注释
    @Category(regression.class)
    @Test
    public void myTest(){} 
  1. 将组添加到 POM.XML
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.21.0</version>
                <configuration>
                    <properties>
                        <property>
                            <name>listener</name>
                            <value>test_listener.TestListener</value>
                        </property>
                    </properties>
                    <groups>categories.regression</groups>
                </configuration>
            </plugin>

我写了以下终端:

mvn clean test -Dtest=categories.regression

并收到此错误消息:

 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project automation: No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]

【问题讨论】:

    标签: java maven jenkins junit categories


    【解决方案1】:

    我会尝试再次运行该命令,但使用-Dgroups=categories.regression 而不是-Dtest

    另外,请查看:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-02-06
      • 1970-01-01
      • 2012-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多