Scala中的验证测试

时间:2011-09-18 18:38:28

标签: unit-testing scala testng verification mockito

我想在我的测试中进行一些验证,但它永远不会失败

import org.testng.annotations.Test
import org.specs.Specification
import org.specs.mock.Mockito
import org.mockito.Matchers._

class Tests extends Specification with Mockito{
  class Foo {
    def bar(){}
  }
  @Test def simplestTest() {
    val t = mock[Foo]
    t.bar()
    there was one(t).bar()   //pass
  }
  @Test def simplestFailTest() {
    val t = mock[Foo]
    there was one(t).bar()  //pass
  }
  @Test def testFail() {
    assert(false)           //fails
  }
}

我将其作为TestNG测试运行。我哪里错了?

1 个答案:

答案 0 :(得分:2)

规范似乎不支持使用TestNG运行测试:http://code.google.com/p/specs/wiki/RunningSpecs