[play-2.5.4-java] Tests not running with activator test command

561 views
Skip to first unread message

ßìnòy S

unread,
Jun 23, 2016, 1:13:14 PM6/23/16
to play-framework
I have a Play Java project [ play-2.5.4-java] and I am trying to execute my Unit tests on command line. 

I can run the test using IntelliJ, but not from command line


Here's my build.sbt file

name := """miman-core"""

// Dev environment is going to use SNAPSHOT versioning
version := "1.0-SNAPSHOT"

lazy val `miman-core` = (project in file(".")).enablePlugins(PlayJava)

scalaVersion := "2.11.8"

routesGenerator := InjectedRoutesGenerator


resolvers += DefaultMavenRepository

resolvers += "Artima Maven Repository" at "http://repo.artima.com/releases"
resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"
resolvers += Resolver.sonatypeRepo("snapshots")
//resolvers += Resolver.bintrayRepo("typesafe","snapshots")

libraryDependencies += filters

libraryDependencies ++= Seq(
  "uk.co.panaxiom" %% "play-jongo" % "2.0.0-jongo1.3",
  "com.feth" %% "play-authenticate" % "0.8.1-SNAPSHOT",
  "de.svenkubiak" % "jBCrypt" % "0.4.1",
  "be.objectify"  %% "deadbolt-java"     % "2.5.0",
  "com.typesafe.play.modules" %% "play-modules-redis" % "2.5.0",
  "org.easytesting" % "fest-assert" % "1.4" % Test,
  "org.seleniumhq.selenium" % "selenium-java" % "2.53.0" % Test,
  "org.seleniumhq.selenium" % "selenium-htmlunit-driver" % "2.52.0" % Test,
  "com.github.fakemongo" % "fongo" % "2.0.7" % Test

)

javaOptions in Test ++= Seq(
  "-Xms512M",
  "-Xmx1536M",
  "-Xss1M",
  "-XX:MaxPermSize=384M"
)


javacOptions ++= Seq("-Xlint:unchecked")
javacOptions ++= Seq("-Xlint:deprecation")
javacOptions ++= Seq("-Xdiags:verbose")

My plugins.sbt file

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.4")

resolvers += DefaultMavenRepository

resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"

// Play enhancer - this automatically generates getters/setters for public fields
// and rewrites accessors of these fields to use the getters/setters. Remove this
// plugin if you prefer not to have this feature, or disable on a per project
// basis using disablePlugins(PlayEnhancer) in your build.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5")

addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.1.10")

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.6")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.0")

Output of activator command

$ activator test
[info] Loading project definition from /home/bossm/workspace/droid-prjs/miman-core/project
[info] Updating {file:/home/bossm/workspace/droid-prjs/miman-core/project/}miman-core-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to miman-core (in build file:/home/bossm/workspace/droid-prjs/miman-core/)
[info] Updating {file:/home/bossm/workspace/droid-prjs/miman-core/}miman-core...
[info] Resolving com.feth#play-authenticate_2.11;0.8.1-SNAPSHOT ...
[warn] Unable to reparse com.feth#play-authenticate_2.11;0.8.1-SNAPSHOT from sonatype-snapshots, using Tue Apr 12 00:44:33 EDT 2016
[warn] Choosing sonatype-snapshots for com.feth#play-authenticate_2.11;0.8.1-SNAPSHOT
[info] Resolving com.feth#play-easymail_2.11;0.8.1-SNAPSHOT ...
[warn] Unable to reparse com.feth#play-easymail_2.11;0.8.1-SNAPSHOT from sonatype-snapshots, using Wed Apr 06 05:29:58 EDT 2016
[warn] Choosing sonatype-snapshots for com.feth#play-easymail_2.11;0.8.1-SNAPSHOT
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 8 Scala sources and 27 Java sources to /home/bossm/workspace/droid-prjs/miman-core/target/scala-2.11/classes...
[success] Total time: 14 s, completed Jun 23, 2016 1:07:48 PM


I have been struggling a lot to get it to run but I'm stumped,

Can someone please help ?

ßìnòy S

unread,
Jun 23, 2016, 2:00:47 PM6/23/16
to play-framework
Additionally my OS is Ubuntu 14.04

Michelle Malaski

unread,
Jul 19, 2016, 4:09:51 PM7/19/16
to play-framework
Hi there,

Did you ever find a solution to this problem? I am currently seeing this same exact issue.

On Thursday, June 23, 2016 at 1:13:14 PM UTC-4, ßìnòy S wrote:

Joachim Dorn

unread,
Jul 20, 2016, 10:49:21 AM7/20/16
to play-framework
Same problem here. 
And trying one specific test "activator testOnly com.acme.MyTest" yields for me "Not a valid key: com (similar: compile, commands, scalaHome)"

Michelle Malaski

unread,
Jul 20, 2016, 4:11:08 PM7/20/16
to play-framework
As an update, we figured out what was going on with ours. The tests were not compiling because our test folder was named "Test", and activator looks for "test". Apparently it is case sensitive. 

Joo Joo

unread,
Jul 21, 2016, 4:02:56 PM7/21/16
to play-framework
So some clarification on the documentation is needed

On command line, executing command as shown below it will work.

$activator "test-only controllers.MySingleController"

Another way is using activator shell and then executing testOnly command

$ activator
[info] Loading project definition from /home/workspace/my-project/project
[info] Set current project to my-project (in build file:/home/workspace/my-project/my-project/)
[my-project] $ testOnly controllers.MySingleController

Hope that helps.

Joachim Dorn

unread,
Jul 22, 2016, 8:48:44 AM7/22/16
to play-framework
Thanks, that helped. Also some confusion in my case came from the setup with sub-projects - its important to have that top-level "test" folder. Also "enablePlugins(PlayJava)" on the sub-modules seems to influence, what the "test" command does.
Reply all
Reply to author
Forward
0 new messages