How to order execution of tests in sbt?

2020-04-18 07:56发布

问题:

Please suggest best approach how to control order of test/spec execution in sbt?

Is there any option like runOrder in maven-sirefire-plugin

回答1:

Sure, it cannot be done clearly for parallel execution, but it solvable for sequential:

parallelExecution in test := false

testGrouping <<= definedTests in Test map { tests =>
  tests.map { test =>
    import Tests._
    new Group(
      name = test.name,
      tests = Seq(test),
      runPolicy = InProcess)
  }.sortWith(_.name < _.name)
}


回答2:

Nope, not with parallel execution. You can ask a test class to run its cases sequentially by adding sequential to the beginning of its declaration.



标签: scala sbt