How to properly run a scalatest FeatureSpec with ParallelTestExecution?

199 views
Skip to first unread message

hordon.f...@gmail.com

unread,
Nov 17, 2015, 10:21:34 AM11/17/15
to scalatest-users
Good day Scalatest team,

I'm importing scalatest in build.sbt like below:

"org.scalatest" % "scalatest_2.10" % "2.1.4",

My test is given below:

import org.scalatest.{ParallelTestExecution, FeatureSpec}

class MyParallelSpec extends FeatureSpec with ParallelTestExecution {
feature("My Feature") {
scenario("Scenario 1") {
println("Scenario 1")
}
scenario("Scenario 2") {
println("Scenario 2")
}
}
}

When I run it in sbt I get:

$ sbt "functionaltest/main:testOnly com.workday.ox.tests.MyParallelSpec"
[info] Loading project definition from /Users/hordon.freeman/parallelscalatest/project
[info] Set current project to OX (in build file:/Users/hordon.freeman/parallelscalatest/)
[info] Compiling 1 Scala source to /Users/hordon.freeman/Documents/parallelscalatest/functionaltest/target/scala-2.10/classes...
[info] Compiling 1 Scala source to /Users/hordon.freeman/Documents/parallelscalatest/functionaltest/target/scala-2.10/main-classes...
Scenario 2
Scenario 1
Reporter completed abruptly with an exception after receiving event: SuiteCompleted(Ordinal(0, 3, 3),DistributedTestRunnerSuite,org.scalatest.tools.DistributedTestRunnerSuite,Some(org.scalatest.tools.DistributedTestRunnerSuite),Some(28),Some(MotionToSuppress),Some(TopOfClass(org.scalatest.tools.DistributedTestRunnerSuite)),None,None,pool-4-thread-6,1446477155587).
java.lang.IllegalStateException: Expected SuiteStarting for completion event: SuiteCompleted(Ordinal(0, 3, 3),DistributedTestRunnerSuite,org.scalatest.tools.DistributedTestRunnerSuite,Some(org.scalatest.tools.DistributedTestRunnerSuite),Some(28),Some(MotionToSuppress),Some(TopOfClass(org.scalatest.tools.DistributedTestRunnerSuite)),None,None,pool-4-thread-6,1446477155587) in the head of suite events, but we got no suite event at all
    at org.scalatest.tools.HtmlReporter.apply(HtmlReporter.scala:948)
    at org.scalatest.DispatchReporter$Propagator$$anonfun$run$1.apply(DispatchReporter.scala:240)
    at org.scalatest.DispatchReporter$Propagator$$anonfun$run$1.apply(DispatchReporter.scala:239)
    at scala.collection.immutable.List.foreach(List.scala:318)
    at org.scalatest.DispatchReporter$Propagator.run(DispatchReporter.scala:239)
    at java.lang.Thread.run(Thread.java:745)
[info] Run completed in 451 milliseconds.
[info] Total number of tests run: 2
[info] Suites: completed 3, aborted 0
[info] Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[success] Total time: 5 s, completed Nov 2, 2015 3:12:35 PM

If I comment out Scenario 2 (or 1), it will execute without problems. Could you please recommend the right way of using the ParallelTestExecution trait in scalatest?

Best regards,
Hordon
Reply all
Reply to author
Forward
0 new messages