【问题标题】:How to run all scalatest of a multi-modules sbt with intellij?如何使用 intellij 运行多模块 sbt 的所有 scalatest?
【发布时间】:2016-06-02 02:10:06
【问题描述】:

我可以跑:

  1. 特定的 scala 测试
    • 通过右键单击测试并选择run
    • 或者如果我之前运行过一次,通过在运行菜单中选择测试 > run...
  2. 我可以通过创建一个新的run/debug configuration > + > junit > test kind = all in package > search for tests = in whole project 来运行所有的 junit 测试
  3. 我可以运行一个子项目的所有scalatest(或junit):右键单击项目>运行> [模块名称]中的scalatest

但是,如果我使用 scala 测试 (+ > scala test > test kind...) 执行与 (2) 相同的操作,那么第一个测试会非常奇怪地失败(似乎 object 没有实例化)而相同的测试如果我使用 (1) 或 (3) 运行它,则通过

配置:

  • 具有多个子项目的 sbt
  • 智能 CE 15.0.2
  • scala 插件 2.1.0
  • scala 2.10

额外问题:如何运行所有测试(junit 和 scalatest)?

【问题讨论】:

  • 这是一个很好的问题,我不知道为什么它被否决了。显然,您可以在终端中运行 sbt test,但我也很想知道是否可以让 IntelliJ IDEA GUI 一次运行所有测试。
  • 为什么投反对票?不要害羞,解释一下自己
  • 我可以做到sbt test,至少持续集成系统做到了。但是在 intellij 中运行它们有几个优点。主要是,它可以在调试中运行,它有更好的显示(以及每次测试所花费的显示时间),并且它有更多机会由我不熟悉 sbt 的非 IT 同事运行。

标签: scala intellij-idea scalatest


【解决方案1】:

您应该可以右键单击项目的根目录并单击Run "All Tests"。这会递归搜索项目中的测试,并将在每个模块中运行测试。

【讨论】:

    猜你喜欢
    • 2020-10-30
    • 2015-10-12
    • 2015-07-10
    • 1970-01-01
    • 2016-08-09
    • 2014-07-26
    • 2018-06-04
    • 1970-01-01
    • 2022-01-04
    相关资源
    最近更新 更多