[2.1] Tests.Setup test options not run

140 views
Skip to first unread message

Huw Giddens

unread,
Feb 28, 2013, 1:26:08 AM2/28/13
to play-fr...@googlegroups.com
In 2.0.4, I can use SBT Tests.Setup instances to run things before tests start running. E.g. adding a setting to a new 2.0.4 project as follows will print "foo" before the tests are run:

object ApplicationBuild extends Build {
    …
    val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
      testOptions in Test += Tests.Setup(() => println("foo"))
    )
}

In 2.1.0, I've tried the following (which I thought should be equivalent), but nothing is printed:

object ApplicationBuild extends Build {
  …
  val main = play.Project(appName, appVersion, appDependencies).settings(
    testOptions in Test += Tests.Setup(() => println("foo"))
  )
}

The option is being loaded by SBT:

[two-one] $ show test:test-options
[info] List(Argument(Some(TestFramework(org.specs2.runner.SpecsFramework)),List(sequential, true)), Argument(Some(TestFramework(com.novocode.junit.JUnitFramework)),List(junitxml, console)), Setup(<function1>))
[success] Total time: 0 s, completed Feb 28, 2013 5:25:33 PM
[two-one] $

A standalone SBT config using SBT 0.12.2 and Scala 2.10.0 works fine. Any ideas what I'm doing wrong here?

Jonas K

unread,
Apr 4, 2013, 5:19:01 PM4/4/13
to play-fr...@googlegroups.com


On Thursday, February 28, 2013 1:26:08 AM UTC-5, Huw Giddens wrote:


In 2.1.0, I've tried the following (which I thought should be equivalent), but nothing is printed:

object ApplicationBuild extends Build {
  …
  val main = play.Project(appName, appVersion, appDependencies).settings(
    testOptions in Test += Tests.Setup(() => println("foo"))
  )
}


I'm running into the same issue (also in 2.1.1). Tests.Cleanup don't run either.
Is there something else that needs to be configured?

_jonas 

Kenji Yoshida

unread,
Apr 23, 2013, 10:06:32 AM4/23/13
to play-fr...@googlegroups.com
fork in Test := true
is default since play2.1.0

https://github.com/playframework/Play20/pull/654


I think "fork in Test := true" cause this problem.
workaround is

Keys.fork in Test := false


but this is not best solution :-(

Has anyone come up with any good ideas?
Reply all
Reply to author
Forward
0 new messages