java - Surefire 插件 > 2.19 版和 junit 套件
问题描述
我正在努力让 maven-surefire-plugin 版本 2.22.0 运行 junit 测试套件。
套件由 junit5 注释定义
@RunWith(JUnitPlatform.class)
@SelectClasses({
SetupTest.class,
SessionTest.class,
})
public class APITests {
}
或由junit4
@RunWith(ProgressSuite.class)
@SuiteClasses({
CountryTest.class,
PaymentTypeTest.class,
})
public class APITests {
}
这两种情况都会导致万无一失地发现没有测试并抛出错误
[错误] 无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test (default-test) on project integrationTests:没有执行测试!
如果我只是直接运行一个测试类,那效果很好。在此尝试更新到 surefire-plugin 2.22 之前,旧版本 2.19.1 可以很好地运行这些“套件”。
有人对我如何继续使用我的套房有一些支持性的想法吗?
下面是 POM 的相关部分。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>SureFireParseReportAndStore</id>
<phase>post-integration-test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>surefireReporting.SureFireParseReportAndStore</mainClass>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>exe</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.exparity</groupId>
<artifactId>hamcrest-date</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.3.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.surefire/surefire-report-parser -->
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-report-parser</artifactId>
<version>2.19.1</version>
</dependency>
</dependencies>
解决方案
推荐阅读
- python - 如何在 python 3.X 中要求数独板输入?,我制作了一个数独求解器程序,但它只适用于我声明的板
- python - 寻找一种简单的方法来访问和导出到 xarray 对象中的多个数据变量的新数组
- azure - 用于检索 Azure 订阅名称、资源组、资源名称、资源类型、标签和位置的 KQL 查询
- javascript - 在添加行时动态检查 for 循环内表的高度
- node.js - JSON中的多词对象名称,节点红色
- c - 创建一个函数以将数据输入到结构中
- cvxpy - 如何使 cvxpy 支持 3d 变量
- spring - 使用 Maven 命令行参数填充的 Spring 值
- javascript - 如何使用表单提交的标头(在 Web 应用程序中)将 JWT 发送回服务器?
- r - R中的线性函数轴缩放