0

I am trying to compare response with expected json stored already as a file. There are few elements in response where the order is different in response. Tried below code but still failing:

def expected_response = read('classpath:api/template/test.json')

And match response == '#(^*expected_response)'

Also tried And match response contains any expected_response

Both cases error comes as actual does not contains expected. Kindly help to resolve.

Patrick W
  • 1,485
  • 4
  • 19
  • 27
Ruchi
  • 1
  • 1
  • Have also tried And match response == '#(^^expected_response)'. This also fails – Ruchi Apr 18 '19 at 06:41
  • Could you provide some test.json file (after you remove confidential data)? Also, what is shuffled? Is it that some objects are in a different order inside of an array for example? – Adrien Apr 18 '19 at 10:16
  • The [order of elements in match](https://github.com/intuit/karate#payload-assertions--smart-comparison) should not matter. If so, open an issue. Also, it would be great to have [a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – Peter Apr 22 '19 at 10:03

0 Answers0