1

My Test.scala has 2 tests that I'd like to run in parallel.

C:/users/Kevin/workspace/playApp> sbt test

class ConcurrentRequests extends FunSuite with BeforeAndAfterAll with ParallelTestExecution {
  val start = System.nanoTime()

  test("foo") {
     println("foo")
     foo        
     println("foo in " + (System.nanoTime - start) / 1000000000 + " seconds.")
  }

  test("bar") {
     println("bar")
     bar        
     println("bar in " + (System.nanoTime - start) / 1000000000 + " seconds.")
  }
}

I tried this post's answers, namely adding testOptions to my $PLAY_APP/build.sbt, as well as using the -P option, but neither worked. I say it didn't work since "foo" printed out, executed its calls, and then bar printed out and executed after.

How can I run this Play test in parallel via sbt?

EDIT

As a work-around, I put the first test in ConcurrentTest.scala and the second in a separate ConcurrentTest2.scala file. And then ScalaTest ran the tests in parallel. From a maintenance point-of-view, I'd rather have a single test file and then run each of them in parallel.

Community
  • 1
  • 1
Kevin Meredith
  • 41,036
  • 63
  • 209
  • 384

0 Answers0