Search code examples
scalaplayframework-2.0specs2

Play: Cannot resolve symbol PlaySpecification


I cannot import PlaySpecification. First, it seems to be part of Specs2, but after importing specs2 it doesnt'show up. https://playframework.com/documentation/2.6.x/ScalaFunctionalTestingWithSpecs2#playspecification

On the other hand here it says it's part or play.api.test, but I cannot find it either https://playframework.com/documentation/2.6.x/api/scala/index.html#play.api.test.PlaySpecification

Does anyone can tell me how I can import PlaySpecification?

I've tried with both configurations in build.sbt, and none of them works:

"org.specs2" %% "specs2-core" % "3.9.5" % "test",
"org.specs2" %% "specs2-mock" % "3.9.5" % "test"

and

specs2 % Test

Solution

  • You need to add the following dependency:

    libraryDependencies += specs2 % Test
    

    After that, if you are using an IDE, refresh the project.