【问题标题】:What is JUnit5 Platform Launcher exactly?JUnit5 平台启动器到底是什么?
【发布时间】: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.jarhamcrest-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...

标签: maven junit5


【解决方案1】:

仅当您想以编程方式启动 JUnit 平台时才需要启动器,即在 IDE、构建工具或控制台运行程序之外。

换句话说:启动器是 IDE 和构建工具使用的 API。

【讨论】:

  • 这个平台启动器与 junit-platform-console 有什么不同吗?如果是,我们什么时候需要 junit-platform-console ?
  • @soung Launcher 是 Java API,console 是命令行工具。
猜你喜欢
  • 2012-01-24
  • 1970-01-01
  • 2011-01-03
  • 2013-08-17
  • 1970-01-01
  • 2016-11-19
  • 1970-01-01
  • 2013-09-11
  • 1970-01-01
相关资源
最近更新 更多