Running unit tests with ScalaTest

Skip to first unread message

Marco Massenzio

Sep 30, 2014, 6:18:33 PM9/30/14
I'm relatively new to Scala and Play - however, I've been successfully running many ScalaTests against the 'core' code of my project without much difficulty.

I've now been struggling for almost two days in making work even the most basic examples described in the documentation:

I'm not sure what I'm doing wrong, but my suspicion is that either some sbt configuration imports the wrong version of ScalaTest + Play, or the code in the docs is plain wrong.

In my build.sbt I have:

scalaVersion := "2.10.4"

libraryDependencies ++= Seq(
  "org.scalatestplus" %% "play" % "1.1.0" % "test",
  "org.scalautils" %% "scalautils" % "2.1.4",

I am importing the 2.3.0 sbt plugin for Play:

// in project/plugins.sbt

+= "Typesafe repository" at ""

// The Play plugin
addSbtPlugin("" % "sbt-plugin" % "2.3.0")

And my unit test:
// test/ApplicationSpec.scala

import{OneAppPerSuite, PlaySpec}
import play.api.Play
import play.api.test.FakeApplication

class ApplicationSpec extends PlaySpec with OneAppPerSuite {

  // Override app if you need a FakeApplication with other than
  // default parameters.
  implicit override lazy val app: FakeApplication =
      additionalConfiguration = Map("ehcacheplugin" -> "disabled")

  "The OneAppPerSuite trait" must {
    "provide a FakeApplication" in {
      app.configuration.getString("ehcacheplugin") mustBe Some("disabled")
    "start the FakeApplication" in {
      Play.maybeApplication mustBe Some(app)

In IntelliJ, ApplicationSpec is marked as a compilation error, as it is apparently missing a bunch of abstract methods (including triple equals, etc.) and if I run it, I get the following:

An exception or error caused a run to abort:$scalatest$words$MatcherWords$_setter_$typeCheck_$eq(Lorg/scalatest/words/TypeCheckWord;)V 
at org.scalatest.words.MatcherWords$class.$init$(MatcherWords.scala:244)
at ApplicationSpec.<init>(ApplicationSpec.scala:5)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
at java.lang.reflect.Constructor.newInstance(
at java.lang.Class.newInstance(

If I run `activator test` in the project's directory, I get instead:

.lang.NoSuchMethodError: org.specs2.runner.Fingerprints$.fp1()Lorg/specs2/runner/SpecificationFingerprint;
        at org
        at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun
        at sun
        at java
        at sbt
        at sbt
        at sbt
        at scala
        at scala
        at scala
        at scala
        at scala
        at sbt
        at sbt
        at sbt

Does anyone know what am I doing wrong?
I've been doing endless searches in Google and StackOverflow, the documentation on this is incredibly thin on the ground and it's virtually impossible to figure out what goes on behind the scenes.

Is it possible that it's just not possible to use ScalaTest with Play 2.3.0 for testing, and we can only use spec2?

Thanks in advance!

Marcos Savoury

Jan 2, 2015, 9:01:51 AM1/2/15
Hi Marco,

Were you able to resolve the issue that you described?  I am facing the same issue as well and I have been pulling my hair out trying to figure out what is going on.

Marcos Savoury

Jan 2, 2015, 9:12:15 AM1/2/15
For anyone else who might find this post, I just figured out what the issue was. I was importing incompatible versions of the plugins.  Verify that the versions match as defined on the page: 
Funny how a good night's sleep is the most effective problem-solving tool we have. 

Marco Massenzio

Jan 2, 2015, 12:49:19 PM1/2/15
Glad you figured it out.
The full explanation of the issue was reported here:

in my own answer.

You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit
To unsubscribe from this group and all its topics, send an email to
For more options, visit

Reply all
Reply to author
0 new messages