2013-05-02 61 views
1

这里是我的SBT编译:SBT不会调用Test.Setup上Play2项目

val main = play.Project(appName, appVersion, appDependencies).settings(defaultScalaSettings:_*) 
    .settings(
    scalaVersion := "2.10.0", 
    resolvers += ..... 
) 
    .configs(IntegrationTest) 
    .settings(Defaults.itSettings : _*) 
    .settings(
    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 

) 

我可以启动两个任务testit:test,但只打印了IntegrationTest文本,而不是定期测试。

我看到Play2有相关的一些默认设置:

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

testOptions in Test += Tests.Cleanup { loader => 
    loader.loadClass("play.api.Logger").getMethod("shutdown").invoke(null) 
}, 

是不是我的构建应该覆盖这些设置吗?

顺便说一句,我可以在此安装程序中调用外部库或测试源类吗?

+0

“顺便说一下,我可以在此安装程序中调用外部库或测试源类吗?”。是的,但是必须以反思方式调用它,因为在编译构建定义时它不会在类路径中。 – retronym 2013-05-03 12:57:38

+0

这似乎有点痛苦。即使调用外部库? – 2013-05-03 13:09:51

回答