Making example specific to build.sbt

(see discussion on https://github.com/sbt/sbt/pull/1139)
This commit is contained in:
Luca Milanesio 2014-02-28 15:18:08 +00:00 committed by Luca Milanesio luca.milanesio@gmail.com
parent 63583d2544
commit bedfb12163
1 changed files with 3 additions and 10 deletions

View File

@ -191,26 +191,19 @@ The setting:
specifies that all tests will be executed in a single external JVM. See
:doc:`Forking` for configuring standard options for forking. More control
over how tests are assigned to JVMs and what options to pass to those is
available with :key:`testGrouping` key. For example:
available with :key:`testGrouping` key. For example in build.sbt:
::
import sbt._
import Keys._
import Tests._
import Defaults._
object ForkTestsBuild extends Build {
{
def groupByFirst(tests: Seq[TestDefinition]) =
tests groupBy (_.name(0)) map {
case (letter, tests) => new Group(letter.toString, tests, SubProcess(Seq("-Dfirst.letter"+letter)))
} toSeq
lazy val root = Project("root", file("."), settings = defaultSettings ++ Seq(
scalaVersion := "2.10.3",
testGrouping in Test := groupByFirst( (definedTests in Test).value ),
libraryDependencies += "org.scalatest" %% "scalatest" % "2.0" % "test"
))
testGrouping in Test <<= groupByFirst( (definedTests in Test).value )
}
The tests in a single group are run sequentially. Control the number