1

I have an output of get operation like :

[ { "field1": "123", "field2": [ "10008" ], "field3": "ABC", "field4": [ "XYZ" ], }]

Now I want to match the filed 4 output in the feature file. I have tried options like:

When method GET Then status 200 And match $response.field4[*] contains ['XYZ']

but I am not getting the desired results and getting Karateexception. Can anyone guide what i am doing wrong and how to match the output of array fields.

1 Answer 1

1

Look at your JSON structure carefully please:

* def response = [ { "field1": "123", "field2": [ "10008" ], "field3": "ABC", "field4": [ "XYZ" ] } ]
* match response[0].field4 contains 'XYZ'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.