Spec2/JUnit/Eclipse用两个以上的例子展示了无根测试



这很令人费解。如果我删除下面代码中的第三个示例,Eclipse中的JUnit运行器将以通常的层次结构显示测试结果。一旦添加了第三个示例,所有3个测试都会退出到unroot tests类别中。

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版本:3.7.2
  • Specs2:"org。scalatra" %% "scalatra-specs2" % 2.2.2

您应该使用最新的specs2版本:"org.specs2" %% "specs2" % "2.3.12"

最新更新