From c9208a47195939834c270b10febc03b54731eed1 Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Thu, 27 Feb 2014 10:40:42 +0000 Subject: [PATCH] Completed a full example of forked tests with grouping The previous example of how to fork group of tests in different JVMs was incomplete and not fully working. a) The "testGrouping in Test" is needed, otherwise the grouping is not known to which phase to apply b) Added a more complete Project definition to explain what the curly brackets section refers to and where the settings need to be included The new complete example works out of the box :-) --- src/sphinx/Detailed-Topics/Testing.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sphinx/Detailed-Topics/Testing.rst b/src/sphinx/Detailed-Topics/Testing.rst index 120c1b740..d33021508 100644 --- a/src/sphinx/Detailed-Topics/Testing.rst +++ b/src/sphinx/Detailed-Topics/Testing.rst @@ -195,14 +195,22 @@ available with :key:`testGrouping` key. For example: :: + 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; - testGrouping := groupByFirst( (definedTests in Test).value ) + + 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" + )) } The tests in a single group are run sequentially. Control the number