Search code examples
eclipsescalajunitspecs2

Spec2/JUnit/Eclipse shows Unrooted Tests with more than two examples


This is very perplexing. If I remove the 3rd example in the code below, JUnit runner in Eclipse shows the test results in the usual hierarchy. As soon as the third example is added, all 3 tests drop out into Unrooted Tests category.

import org.junit.runner.RunWith
import org.specs2.mutable.Specification
import org.specs2.specification.AllExpectations

@RunWith(classOf[org.specs2.runner.JUnitRunner])
class ThreeTests extends Specification with AllExpectations {

    "My Repository" should {
        "do x" in {
            1 === 1
        }
        "do y" in {
            1 === 1
        }
        "do z" in {
            1 === 1
        }
    }
}
  • ScalaIDE: 3.0.1-vfinal-20130718-1727-Typesafe
  • Eclipse SDK Version: 3.7.2
  • Specs2: "org.scalatra" %% "scalatra-specs2" % 2.2.2

Solution

  • You should use the latest specs2 version: "org.specs2" %% "specs2" % "2.3.12"