在sbt中并行运行ScalaTest套件(而不是测试)?

时间:2014-03-21 07:36:55

标签: sbt scalatest

我使用SBT 0.13.1 并希望并行运行ScalaTest测试套件(不是每个套件中的测试)。

设置了parallelExecution in Test := false,但看起来测试套件是按顺序运行的。

我做的实验是:

class BlahSuite extends FunSuite {
  test("run 1") {
    println("running one")
    Console.err.flush()
    Console.out.flush()
    Thread.sleep(10000)
  }
}

class Blah2Suite extends FunSuite{
  test("run 2") {
    println("running two")
    Console.err.flush()
    Console.out.flush()
    Thread.sleep(10000)
  }
}

我在running two后10秒钟看到running one,这让我相信run 2run 1完成之前没有开始。

1 个答案:

答案 0 :(得分:0)

我不确定你的做法有何不同,我使用Scala 2.10.3将你的代码复制到一个空的SBT项目(0.13.1)中,默认情况下并行运行,请参阅我的输出:

running one
running two
[info] Blah2Suite:
[info] - run 2
[info] BlahSuite:
[info] - run 1
[info] Run completed in 10 seconds, 278 milliseconds.
[info] Total number of tests run: 2
[info] Suites: completed 2, aborted 0
[info] Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[success] Total time: 11 s, completed Mar 21, 2014 11:58:24 AM

使用ScalaTest版本2.1.0和2.0进行尝试。

相关问题