There's a lot of stuff from Scala 2.8.0-RC, but things seem to have changed a lot since then and I'm not finding much.
I'd just like some clear instructions on how to get my SBT project (SBT version 0.7.4, Scala version 2.8.1) working with scala test.
Thanks so much.
First thing is to add the ScalaTest dependency to your SBT project. In <project_root>/project/<CLASS_THAT_EXTENDS_DEFAULTPROJECTINFO>.scala
you will need to add the line:
val scalatest = "org.scalatest" % "scalatest" % "1.3"
This adds the ScalaTest dependency to your project. ScalaTest 1.3 will work fine with Scala 2.8.1.
Then create a test class like so in <project_root>/src/test/scala
:
class Foo{
def addOne(i: Int): Int = {
i + 1
}
}
import org.scalatest.Spec
class Test extends Spec {
describe("Add one test") {
it("Should be two") {
expect(2) { new Foo().addOne(1) }
}
}
}
First run 'sbt update' so that sbt will update your repo with the new ScalaTest dependency.
With this you should be able to run 'sbt test' or simply 'test' in the SBT console and it will run the test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With