Question

How to run scala specs 2 in eclipse (scala-ide)?

My steps were:

  1. sbt eclipse - generate eclipse project from existing source
  2. eclise: import project - open project in eclipse ide
  3. Put break-point in my SPECS 2 test (class MyTest extends Specification { ... )
  4. Try to run test ...? (usually I do it in IntelliJ IDEA.. but today going to check how eclipse works with debug in scala..)
Was it helpful?

Solution

At the moment, you can use a little hack. If you annotate your Specs2 class as follows:

@RunWith(classOf[JUnitRunner])

With older versions of specs2, this should be:

@RunWith(classOf[JUnitSuiteRunner])

The Scala IDE can run it with the JUnit runner simply through the popup menu (see the details here).

I'm working on a Specs2 plug-in for the Scala IDE (well, unfortunately I haven't really found time for it for a while, but it's still on my list).

It has a working version for the previous version of the Scala IDE, it is a bit difficult to set it up but works. See the details here: http://rlegendi.github.io/specs2-runner/

OTHER TIPS

I had to make sure the build.sbt file included the following information:

scalacOptions in Test ++= Seq("-Yrangepos")
"org.specs2" %% "specs2-core" % "3.6.5" % "test",
"org.specs2" %% "specs2-junit" % "3.6.5" % "test",
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top