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


here sbt build:

  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    ) 

i can launch both tasks test , it:test, prints text integrationtest, , not regular test.

i see play2 has default settings related:

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) }, 

isn't build supposed override these settings?

by way, can call external library or test source class in setup?

maybe constraint of sbt.

sbt official documents says

setup , cleanup actions not supported when group forked.

https://github.com/sbt/sbt/blob/v0.12.2/src/sphinx/detailed-topics/testing.rst#forking-tests

http://www.scala-sbt.org/0.12.2/docs/detailed-topics/testing.html

 fork in test := true 

is default play2.1.0

https://github.com/playframework/play20/pull/654/files#l5l110


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -