问题
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