devoured elysium
devoured elysium

Reputation: 105027

Forking each ScalaTest suite with sbt

I have to run some integration tests and I would like for each test-suite to run on its own forked VM. The different suites should run sequentially, and the tests inside each suite should also run sequentially.

Is this achievable with sbt / scalatest without too much tinkering? I do know I can run the whole test suites in a forked VM, but that's too little for my needs.

Upvotes: 0

Views: 443

Answers (1)

devoured elysium
devoured elysium

Reputation: 105027

After some digging, this seems to do the trick. Every suite will run on a forked instance:

fork in Test := true
testGrouping in Test := (definedTests in Test).value.map { suite =>
  Group(suite.name, Seq(suite), SubProcess(ForkOptions()))
}

Although definedTests makes it look like it's getting the list of tests, it's actually getting us the list of test suits. Then, for each one of them, we'll just pass a SubProcess, that tells sbt to fork the process.

Upvotes: 2

Related Questions