2

test 命令不能触发 Junit5 测试用例

 2 years ago
source link: https://blog.victorchu.info/posts/92d2d225/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

test 命令不能触发 Junit5 测试用例

发表于

2021-11-30 分类于 FAQTest ToolJunit5

Waline: 0 阅读次数: 本文字数: 605 阅读时长 ≈ 1 分钟

test 命令不能触发 Junit5 测试用例

maven 不能触发 Junit5 测试用例

使用 MAVEN PACKAGE 打包时,JUnit4 可以在打包时运行全部测试用例,而 JUnit5 不会运行。这是因为现在 maven 并不能直接识别 JUnit5 测试用例,需要在插件中添加 maven surefire。

<build>
<plugins>
<!--fix: mvn test not run junit5 @Test -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>

再次运行 mvn clean pacakge 即可触发 TestCase。

gradle 不能触发 Junit5 测试用例

在项目下使用./graldew test, 不能触发 Junit5 的测试用例,但是 Junit4 是可以的。

buildscript {
dependencies {
classpath ("org.junit.platform:junit-platform-gradle-plugin:1.0.0-M4")
}
}
坚持分享,您的支持将鼓励我继续创作!

欢迎关注我的其它发布渠道


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK