I'd like to have a single Scenario in my mock service to check for all possible schema issues, so I tried defining my schema in the background like this: * def mySchema = {place: { id: '#string',},id: '#string',number: '#number'}
then in my Scenario I tried this: Scenario: pathMatches('my/api/path') && !karate.match(mySchema).pass
but it threw this error: java.lang.RuntimeException: syntax error, expected '==' for match
Clearly my syntax is off. What's the right way to write this?
Asked
Active
Viewed 23 times
1

Scott MacDonald
- 115
- 1
- 8
-
this is a good reference for `match()` https://stackoverflow.com/a/50350442/143475 – Peter Thomas Oct 23 '20 at 18:54
-
Here's what I ended up with: `!karate.match("request == mySchema").pass` which doesn't error, but it seems to match on what I believe is a request with the proper schema. `{"place": {"id": "anID"},"id": "anID","number": 10}` – Scott MacDonald Oct 23 '20 at 19:45