问题
I would like to use "OR" operator for assertion statement in Karate API.
This is the first time I am trying to OR operator in Karate API:
match response.items[0].type == 'Purchase'
I would like to use an OR operator like:
match response.items[0].type == 'Purchase' or 'Freeplay'
I have not been able to successfully execute with or statement
回答1:
Sometimes assert is the simplest option:
* def itemType = response.items[0].type
* assert (itemType == 'Purchase') || (itemType == 'Freeplay')
There are other ways, see: https://stackoverflow.com/a/57377284/143475
来源:https://stackoverflow.com/questions/57527217/how-to-put-or-operator-in-karate-api-assertion-statement