LoginSignup
12
11

More than 5 years have passed since last update.

Scala: sbt+scalatestテストを並列実行する

Last updated at Posted at 2014-03-06

build.sbtに下記のフラグを立てるだけで、テスト実行が並列化できる!

build.sbt
parallelExecution in Test := true

なお、並列実行したいテストスイートは ParallelTestExecution を継承する。

class StepSpec extends FlatSpec with ParallelTestExecution {
    // ...
}

SharedNothingでStatelessなテストは並列実行にするといいかも。

並列数を指定する

並列数はCPUの数などから自動的に算出されるらしい。

並列数の指定を行う場合は、 build.sbt に明示する。

10並列にする例:

build.sbt
concurrentRestrictions in Global := Seq(
  Tags.limit(Tags.Test, 10)
)
12
11
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
11