I have a Play Framework 2.3 project in which I\'d like to separate unit tests and functional tests as follows:
sbt test
should run unit tests
This is what I ended up doing, which allows me to:
/test
directorysbt test
for Unit Tests and sbt fun:test
for functional/integration testsHere is the build.sbt
, no need for a project/Build.scala
libraryDependencies ++= Seq( ... "com.typesafe.play" %% "play-json" % "2.2.3", "org.scalatest" %% "scalatest" % "2.1.5" % "test", "org.mockito" % "mockito-all" % "1.9.5" % "test" ) lazy val FunTest = config("fun") extend(Test) def funTestFilter(name: String): Boolean = ((name endsWith "ItTest") || (name endsWith "IntegrationTest")) def unitTestFilter(name: String): Boolean = ((name endsWith "Test") && !funTestFilter(name)) lazy val root = project in file(".") configs(FunTest) settings( inConfig(FunTest)(Defaults.testTasks) : _*) testOptions in FunTest := Seq(Tests.Filter(funTestFilter)) testOptions in Test := Seq(Tests.Filter(unitTestFilter))