I'm using Karate for my mock service, so my karate files have Scenarios that include the params I need to match to run that scenario. I've had success with things like:
pathMatches('my/api/path') && methodIs('post') && (karate.match("json.array[*].key contains null").pass
I now want to add something like 'or json.array[*].key == #isnotpresent' based on what I found in this article: https://github.com/intuit/karate/issues/270
It looks like you use the match keyword in the body of a test, but how could I do this in the Scenario? Use karate.match()? If so, what's the proper syntax? I know I'll need to do this kind of stuff more, so I want to get a handle on it.
I tried something like: karate.match('json.array[*] contains { key: 'notpresent'}').pass
and karate.match('json.array[*] == {key: '#notpresent'}').pass
without success.
I'm using 0.9.6 version of Karate that I found when I asked this question: Matching key value pairs in a request in a Karate Netty scenario
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…