Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有许多使用 groovy 的测试用例。
我希望能够让测试用例失败,但继续执行脚本的其余部分。尝试使用:
testRunner.fail("没用")
也试过
断言 false :“它不起作用”
但是即使未选中错误中止,它们也会中止测试用例。
有任何想法吗?
使测试用例失败的通常方法是调用fail()Junit 的方法,而不是使用assertor testRunner.fail()。但是,我不确定是否会执行失败测试之后的测试。
fail()
assert
testRunner.fail()
此fail方法是静态方法Assert或实例方法,TestCase具体取决于您使用的是 JUnit 4 还是 3.8。
fail
Assert
TestCase