One of the API testing using intuit/karate,
Expected JSON is: {name: hello,
config:[{username: abc, password: xyz},{username: qwe, password: tyu}]}
There is two possibility of an API response.
First possible actual JSON: {name: hello,
config:[{username: qwe, password: tyu},{username: abc, password: xyz}]}
Second possible actual JSON: {name: hello,
config:[{username: abc, password: xyz},{username: qwe, password: tyu}]}
Likewise, the sequence of array element is different in actual response, hence following approach of validation of response throws error randomly.
- And response == < ExpectedResponse >
- And response contains < ExpectedResponse >
Sometimes error is thrown as : Error : { Actual: response.config[0].abc, Expected: response.config[0].qwe }
Sometimes error is thrown as : Error : { Actual: response.config[0].qwe, Expected: response.config[0].abc }
Would you please provide exact karate approach of JSON validation in which entire JSON along with ignore the sequence of element in JSON containing array ?