性能测试值被scalatest忽略

时间:2018-06-22 05:55:26

标签: scala scalatest scalacheck

这使我发疯。以下性能测试通过scalatest(使用“ sbt测试”目标)通过。

import org.scalatest.FlatSpec
import org.scalatest.prop.PropertyChecks

class FigaroCheckSpec extends FlatSpec with PropertyChecks {
  "this property" should "fail" in { forAll { (p :Int) => false } }
}

为什么?我同时尝试了FlatSpec和FreeSpec。当我直接将Checkers与scalacheck API结合使用时,它也可以工作(即失败)。

1 个答案:

答案 0 :(得分:2)

您那里没有检查/断言,请尝试以下操作:

"this property" should "fail" in { forAll { (p :Int) => assert(false) } }