0

Is there any way to check if object is empty then ok if not then check if it matches a fixed structure?

I mean, something like:

* def expectedDelayEntries = response.delayEntries == "{}" ? {} : '#(delayEntries)'
krlzlx
  • 5,594
  • 14
  • 47
  • 53

1 Answers1

1

Yes. Refer to the docs: https://github.com/intuit/karate#conditional-logic

Do this in 2 steps.

* def expected = condition ? { foo: '#string' } : { bar: '#number' }
* match response == expected
Peter Thomas
  • 47,282
  • 14
  • 68
  • 196