Is it possible to do soft assertion in the karate

无人久伴 提交于 2019-12-11 09:55:28

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/54107517/is-it-possible-to-do-soft-assertion-in-the-karate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!