Parallel test runner for play framework
Asked Answered
D

2

9

Functional tests involving the TestServer class of the Play Framework seem to work only inside the Play console.

Unfortunately the stock test runner in the Play console executed by the play test command executes the tests in sequence and that takes a lot of time. I think they would run faster if they were executed parallel.

Is there a way to run the tests parallel?

Update: SBT supports running tests parallel and in different JVMs that makes it possible to have multiple TestServer instances parallel if they are listening on different ports, in theory. It seems Play ignores these settings. See my reported issue: https://github.com/playframework/Play20/issues/849. The bounty goes for somebody who shows a way that makes the Play Framework honor these SBT test settings to run junit based tests parallel in different JVMs with a Build.scala file.

Damiendamietta answered 11/3, 2013 at 12:13 Comment(0)
D
1

After investigation of the topic it seems that Play ignores SBT test configuration settings. I reported the issue here:

https://github.com/playframework/Play20/issues/849

I don't want to mark my answer accepted because I hope that I have overlooked something and that it's possible to run tests parallel in play framework.

Damiendamietta answered 13/3, 2013 at 11:3 Comment(0)
U
0

Default specs2 setting of Play2 doesn't allow to execute parallel. https://github.com/playframework/Play20/blob/master/framework/project/Build.scala#L290

 parallelExecution in Test := false

So you need to override this setting in your Build.scala.

 parallelExecution in Test := true

But I think you can't execute test parallel because TestServer need port. If you want execute test parallel, you should change port in every test cases.

Umbra answered 12/3, 2013 at 5:11 Comment(2)
I added the setting like this, but it seems have no effect: val main = play.Project(appName, appVersion, appDependencies).settings( parallelExecution in Test := true ) This commit also suggests that running multiple test servers have more problems than a conflicting port: github.com/playframework/Play20/commit/…Damiendamietta
fork in Test := true would solve the issue of running multiple TestServer instances in parallel. (Assuming the port assignment have taken care of) The problem is that it seems that play ignores my settings defined like this: val main = play.Project(...).settings( [settings here] ) Even very simple tests that could run parallel are not executed parallel regardless the parallelExecution in Test := true setting.Damiendamietta

© 2022 - 2024 — McMap. All rights reserved.