b_pcakes
b_pcakes

Reputation: 2540

How to import specs library

How do I import specs library? I get the following error:

scala> import org.specs._
<console>:11: error: object specs is not a member of packa
ge org
       import org.specs._
              ^

I think it has to do with classpath, but I don't know how to fix it because I am new to scala.

In fact, I am actually trying to run tests in sbt, so it would be helpful if you could tell me how to import specs in sbt.

Upvotes: 0

Views: 403

Answers (2)

Sandeep Purohit
Sandeep Purohit

Reputation: 3692

Just add the dependency in build.sbt and compile it again then you can import spec2.

Upvotes: 0

Jamith
Jamith

Reputation: 26

Your build.sbt should include

libraryDependencies ++= {
  Seq(
    "org.specs2"        %% "specs2"             % "2.3.12"             %    "test"
 )
}

and in your test.scala

import org.specs2.mutable.Specification

class PlayerTest extends Specification {

   // test code here
}

Upvotes: 1

Related Questions