简体   繁体   中英

Parallel test runner for play framework

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM