SBT doesn't call Test.Setup on a Play2 project

Here is my SBT build:

  val main = play.Project(appName, appVersion, appDependencies).settings(defaultScalaSettings:_*)
    scalaVersion := "2.10.0",
    resolvers += .....
    .settings( Defaults.itSettings : _*)
    testOptions in Test += Tests.Setup( () => println("Setup Test yoohooo") ),
    testOptions in Test += Tests.Cleanup( () => println("Cleanup Test yoohoo") ),
    scalaSource in Test <<= baseDirectory / "test/unit",
    parallelExecution in Test := true,

    testOptions in IntegrationTest += Tests.Setup( () => println("Setup Integration Test yoohoo") ),
    testOptions in IntegrationTest += Tests.Cleanup( () => println("Cleanup Integration Test yoohoo") ),
    scalaSource in IntegrationTest <<= baseDirectory / "test/integration",
    parallelExecution in IntegrationTest := false


I can launch both tasks test and it:test, but it only prints the text for the IntegrationTest, and not for the regular Test.

I see that Play2 has some default settings related:

testOptions in Test += Tests.Setup { loader =>
  loader.loadClass("play.api.Logger").getMethod("init", classOf[]).invoke(null, new"."))

testOptions in Test += Tests.Cleanup { loader =>

Isn't my build supposed to override these settings?

By the way, can I call an external library or a test source class in this Setup?


Maybe this is constraint of sbt.

sbt official documents says

Setup and Cleanup actions are not supported when a group is forked.

fork in Test := true

is default from Play2.1.0

Need Your Help

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.