I thought that this kind of thing might work, but it appears to have no effect:
> sbt tests -- -n SlowTest
Is this possible, and if so, what am I missing?
Thanks!
--
paul.butcher->msgCount++
Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?
http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
MSN: pa...@paulbutcher.com
AIM: paulrabutcher
Skype: paulrabutcher
I don't know what 'tests' is, so I'll assume it is like test-only. If you are
running sbt from a shell, you need to escape the spaces. For example:
$ sbt 'test-only -- -n SlowTest'
I would expect that you would get an error indicating that sbt doesn't know
what to do with '--'.
-Mark
On Mon, 7 May 2012 08:03:53 -0700 (PDT)If this is what you are actually running, you should get an error about -n not being a command or something similar. sbt processes a sequence of commands and not just one command at a time, so each command+arguments is passed as one argument to sbt.
brett <br...@jemstep.com> wrote:
>
> I run the test as follows, with no special configuration in my build.scala
> / *.sbt files:
> sbt test-only -- -n UnitTest -l "IntegrationTest ComponentTest"
sbt "test-only -- -n ..."
As a side note, Tests.Argument has a repeated parameter, so you can put all of those arguments in one call. It should be equivalent to passing them separately.
>
> However, if I update the options via my build.sbt for 1 module:
> testOptions in Test ++= Seq(Tests.Argument("-oDS"), Tests.Argument("-n"),
> Tests.Argument("UnitTest"), Tests.Argument("-l"),
> Tests.Argument("ComponentTest IntegrationTest" ))
This is described in the "Additional test configurations with shared sources" section on the Testing page.
https://github.com/harrah/xsbt/wiki/Testing
object B extends Build { lazy val root = Project(id = "myproj",base = file(".")) .aggregate(commons, model, server) .configs( UnitTest ) .configs( ComponentTest ) .configs( IntegrationTest ) .settings( inConfig(UnitTest)(Defaults.testTasks) : _*) .settings( inConfig(ComponentTest)(Defaults.testTasks) : _*) .settings( inConfig(IntegrationTest)(Defaults.testTasks) : _*) .settings( libraryDependencies += specs, testOptions in UnitTest := Seq(Tests.Filter(unitTestFilter)), testOptions in ComponentTest := Seq(Tests.Filter(componentTestFilter)), testOptions in IntegrationTest := Seq(Tests.Filter(integrationTestFilter)) ) lazy val commons = Project(id = "myproj-commons", base = file("myproj-commons")) lazy val model = Project(id = "myproj-model", base = file("myproj-model")) dependsOn(commons) lazy val server = Project(id = "myproj-server", base = file("myproj-server")) .dependsOn(model,commons) .configs( UnitTest ) .configs( ComponentTest ) .configs( IntegrationTest ) .settings( inConfig(UnitTest)(Defaults.testTasks) : _*) .settings( inConfig(ComponentTest)(Defaults.testTasks) : _*) .settings( inConfig(IntegrationTest)(Defaults.testTasks) : _*) .settings( libraryDependencies += specs, testOptions in UnitTest := Seq(Tests.Filter(unitTestFilter)), testOptions in ComponentTest := Seq(Tests.Filter(componentTestFilter)), testOptions in IntegrationTest := Seq(Tests.Filter(integrationTestFilter)) ) def unitTestFilter(name: String): Boolean = name endsWith "UnitSpec" def componentTestFilter(name: String): Boolean = name endsWith "ComponentSpec" def integrationTestFilter(name: String): Boolean = name endsWith "IntegrationSpec" lazy val UnitTest = config("unitTest") extend(Test) lazy val ComponentTest = config("componentTest") extend(Test) lazy val IntegrationTest = config("integrationTest") extend(Test) lazy val specs = "org.scala-tools.testing" %% "specs" % "1.6.9" % "test" }
If you run into issues, please post a sample project or at least a build definition that shows the problem.
-Mark
These can be put in a method that constructs a Seq[Setting[_]]:
and then used reused for root and server in a single .settings call:
.settings( testSettings : _*)