JUnit5 Platform Launcher 究竟是什么?
What is JUnit5 Platform Launcher exactly?
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>
只有当您想以编程方式启动 JUnit 平台 运行 时才需要启动器,即在 IDE、构建工具或控制台 运行ner 之外。
换句话说:启动器是 API 被 IDE 和构建工具使用。
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
?
将 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>
只有当您想以编程方式启动 JUnit 平台 运行 时才需要启动器,即在 IDE、构建工具或控制台 运行ner 之外。
换句话说:启动器是 API 被 IDE 和构建工具使用。