【问题标题】:What does it mean to set up a "Jupiter API artifact"?设置“Jupiter API 工件”是什么意思?
【发布时间】:2019-09-23 02:58:35
【问题描述】:
dependencies{
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
}

上面的代码似乎是添加到 build.gradle 文件的依赖项部分所必需的,以便在 gradle 项目中运行 junit 5 测试。但它不起作用......

【问题讨论】:

    标签: java gradle build.gradle junit5


    【解决方案1】:

    Jupiter API 为测试实现提供基本接口和注释。它包含正确。 它究竟是如何不工作

    如果您只是无法运行测试,您很可能忘记让 Gradle 运行它们。检查 Gradle 版本。

    如果您有 Gradle 4.6+,you can 配置具有内置支持的 test 任务

    test {
       useJUnitPlatform()
    }
    

    如果您的 Gradle 较旧,那么您需要 junit-platform-gradle-plugin,该插件将被停用。

    【讨论】:

      【解决方案2】:
      dependencies{
      testCompile("org.junit.jupiter:junit-jupiter-params:5.5.2")
      }
      

      这可以代替。

      【讨论】:

        猜你喜欢
        • 2013-02-14
        • 2018-11-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-11-09
        • 1970-01-01
        相关资源
        最近更新 更多