是否可以在空手道中进行软断言 [英] Is it possible to do soft assertion in the karate
本文介绍了是否可以在空手道中进行软断言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
即使断言/匹配之一失败,是否可以继续执行测试步骤?
Is it possible to continue the execution of test step even if one of the assert/match fails?
Ex:
Scenario: Testing
* def detail = {"a":{"data":[{"message":["push","dash"]},{"message":["data","Test"]}]}}
* match detail contains {"a":{"data":[{"message":["push","dash"]}]}}
* print detail
此处匹配将失败,但此时执行会停止. 有没有办法进行软断言,以便执行下一步?
Here match will fail but execution stop at that point. is there a way to do a soft assertion so that next step gets executed?
推荐答案
如果使用Scenario Outline
,则即使失败,也会执行每个行".
If you use a Scenario Outline
each "row" is executed even if one fails.
Scenario Outline: Testing
* def detail = { a: 1, b: 2, c: 3 }
* match detail contains <expected>
Examples:
| expected |
| { a: 1 } |
| { b: 2 } |
| { c: 3 } |
否则,空手道没有软"断言.
Otherwise no, Karate does not have "soft" assertions.
这篇关于是否可以在空手道中进行软断言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文