I want to match multiple response
of an API
. Please find below Scenario Outline
.
Background:
* def kittens = read('../sample.json')
Scenario Outline: Create Test1
Given url url
And request <Users>
When method POST
Then status 200
And match response.success.name == <expectedName>
And match response.success.contact.mobile == <expectedMobile>
Examples:
|Users|expectedName|expectedMobile|
|kittens.User1|'Micheal'|'123456'|
|kittens.User2|'Steve'|'998877'|
In the above case, I am able to match for 2 fields but I want to validate for more fields, but it is increasing pile of code that I do not want.
Multiple response
of an API
:
"success": {
"name": "Micheal",
"addr": "Tesla road",
"contact": {
"mobile": 123456,
"phone": 4422356
}
}
"success": {
"name": "Steve",
"addr": "Karen Road",
"contact": {
"mobile": 998877,
"phone": 244344
}
}
I am looking for minimizing the lines of code.
Can you please tell me another way where I can load entire response
into expected
and then I will traverse in the example
section?
Please help me. Thank you !!