【发布时间】:2019-03-23 10:23:00
【问题描述】:
JUnit 5 是模块化的。
我了解一切都基于平台模块 (junit-platform-engine-1.3.2.jar):
木星模块(API + 引擎部件:junit-jupiter-engine-5.3.2.jar + junit-jupiter-api-5.3.2.jar)和
老式模块(API + 引擎部件:junit-vintage-engine-5.3.2.jar + junit-4.12.jar 和hamcrest-core-1.3.jar)都使用平台模块作为基本模块。
但是什么是平台启动器,什么时候需要它?
我何时以及为什么需要它以及如何将其添加到pom.xml?
(图片由link提供)
将 Jupiter(仅适用于 JUnit 5 测试)和 Vintage(适用于 Junit4/Junit3 兼容性 - 从 JUnit5 运行旧版 JUnit4 测试)添加到 pom.xml 是这样的(仅供将来参考):
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
<!-- Vintage Module to run JUnit4 from JUnit 5 -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
【问题讨论】:
-
我会推荐使用最新的版本 5.4.0...