How do I specify the order in which Specs2 tests are run?

My tests run sequentially with an option parallelExecution in Test := false

.

It seems that the order in which the tests are run is not necessarily the order of the tests in my class file. Is this observation correct, and if so, is there a way to specify the order of execution?

+3


source to share


1 answer


There are 2 levels of parallelization. The first is to run classes in parallel using sbt. This can be deactivated with the sbt installation you mention. The second is to run the examples in parallel within specs2.

You can run the specs2 examples sequentially by adding an argument sequential

at the beginning of your spec:

class MySpec extends mutable.Specification {
  sequential
  ...
}
class MySpec extends Specification { def is = sequential ^ """
   ...
  """
}

      



or add it to sbt build file:

testOptions in Test += Tests.Argument(TestFrameworks.Specs2, "sequential")

      

+4


source







All Articles