I am building a Scala project in the standard directory layout using sbt. I want to run sbt console
and import my unit tests so that I can play with them in the Scala REPL. What is the easiest way to do this? Is there a command I can pass to sbt, or something I can add to build.sbt
?
Note that I don't necessarily want to run unit tests from the sbt console
. (Though that would be nice too.) Instead a have test fixtures that set up data structures that I want to use in my REPL session.
Use test
configuration scope, like this:
sbt> Test/console
For more information, see Scopes in the sbt documentation.
With specs2 for example, you can go:
sbt> Test/console
console> import mytestpackage._
console> import org.specs2._
console> specs2.run(new MySpec)