I have a multiproject with some settings and custom configs shared between them. Those settings are configs that should run Specs2 tests by tag. However, when I run those new configs they aren't running any test at all.
import sbt.TestFrameworks.Specs2
import sbt.Tests.Argument
import sbt._
import sbt.Keys._
trait Settings extends Dependencies {
lazy val FunctionalTest = config("functional") extend(Test)
val commonConfigs = Seq(FunctionalTest)
val commonSettings =
inConfig(FunctionalTest)(Defaults.testSettings) ++
Seq(
libraryDependencies ++= mainDeps,
libraryDependencies ++= testDeps map (_ % "test"),
testOptions in Test += Argument(Specs2, "exclude", TestTag.FunctionalTest),
testOptions in FunctionalTest += Argument(Specs2, "include", TestTag.FunctionalTest)
)
}
After defining functional:test task like this it doesn't run any tests while test task would run all tests in all subprojects which aren't tagged with TestTag.FunctionalTest.
Removing testOptions in FunctionalTest += Argument(Specs2, "include", TestTag.FunctionalTest) doesn't change the result, but removing inConfig(FunctionalTest)(Defaults.testSettings) ++ make functional:test behave exactly like test (run all except TestTag.FunctionaTest).
How can I make test run everything except TestTag.FunctionalTest tagged tests (as it is now) and functional:test to run only tagged tests? I looked at SBT and Spec2 documentation, but they only have working examples for filtering tests by their name (SBT) or using command line arguments to filter them (Specs2) and nowhere could I find information on how to combine them.
Aucun commentaire:
Enregistrer un commentaire