问题
so, I want to use conditional logic in my code, which the condition is when I got response.response_code == '00'
so it will run
And match response == res_3[0]
And match each response.data.bills == res_3[1]
And if response.response_code != '00'
, it will run
And match response == res_3
And match each response.data.bills == res_3
so, what is the best conditional logic for this case ??
回答1:
Read the docs please: https://github.com/intuit/karate#conditional-logic
Use a second feature file:
* eval if (response.response_code != '00') karate.call('it-will-run.feature')
Note: you can't use match
where JavaScript is expected, refer: https://stackoverflow.com/a/53961806/143475
来源:https://stackoverflow.com/questions/54524997/the-best-conditional-logic-for-match-and-match-each-case