【问题标题】:junit5 parallel execution doesn't work through ConsoleLauncherjunit5 并行执行不能通过 ConsoleLauncher 工作
【发布时间】:2019-08-27 06:55:45
【问题描述】:

基于 JUnit5 控制台启动器docs,似乎没有办法配置并行执行。 ConsoleLauncher 不支持并行执行还是应该在 junit-platform.properties 中设置配置就足够了?

我尝试使用 ConsoleLauncher(在 junit-platform.properties 中设置并行模式),但测试似乎仍然按顺序运行。不过,我可以通过 Gradle 并行运行它们。

【问题讨论】:

  • 你试过--config command-line option 吗?也许使用这两个参数 junit.jupiter.execution.parallel.enabled = truejunit.jupiter.execution.parallel.mode.default = concurrent - 我将其作为评论发布,因为我现在无法重现
  • 你说得对,我必须在调用 ConsoleLauncher 时添加特定的配置。

标签: junit junit5


【解决方案1】:

我可以通过在调用 ConsoleLauncher 时添加特定配置来使其工作

  • -Djunit.jupiter.execution.parallel.enabled=true
  • -Djunit.jupiter.execution.parallel.mode.default=concurrent

参考:https://junit.org/junit5/docs/current/user-guide/#running-tests-config-params

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-03
    相关资源
    最近更新 更多