i tried simple validation of part of json tree in json Payload-> ABC.json
"portedHistory": {
"portedDate": "2020-04-12",
"numberOfPorts": 3,
"portedSinceXDays": 1170,
"currentCarrierCircle": "Verizon Verizon Wireless",
"originalCarrierCircle": "T-Mobile T-Mobile US",
"changeInCarrierRegion": "NOT_SUPPORTED",
"portedEvents": [
{
"carrierCircle": null,
"portedDate": "2020-04-12"
},
{
"carrierCircle": null,
"portedDate": "2016-05-11"
},
{
"carrierCircle": null,
"portedDate": "2016-05-11"
}
]
}
In karate.feature file
Scenario Outline: ABC_Automation discreption - <Scenario>
Given url requestUrl
And def payload = read("<Scenario>.json")
And headers headers
And request payload.request
* set payload.response.portedHistory.portedSinceXDays = "#Ignore" --->not working for number
* set payload.response.portedHistory.currentCarrierCircle = "#ignore" --> working for string
When method POST
* print payload.request
* print payload.response
* print karate.pretty(response)
Then status <statusCode>
And match $ contains payload.response.portedHistory
Examples:
| Scenario | statusCode |
| ABC.json | 200 |
i want #ignore to be working for dynamic field "portedSinceXDays" which changes daily, So i tried #ignore for ported since. which is not working for number datatype.
few can suggest to validate the response outside with individual key, but as i cant do that because my json response is pretty dynamic and i need to validate for different region data.
Please help me to resolve the issue.
In karate.feature file
Scenario Outline: ABC_Automation discreption - <Scenario>
Given url requestUrl
And def payload = read("<Scenario>.json")
And headers headers
And request payload.request
* set payload.response.portedHistory.portedSinceXDays = "#Ignore" --->not working for number
* set payload.response.portedHistory.currentCarrierCircle = "#ignore" --> working for string
When method POST
* print payload.request
* print payload.response
* print karate.pretty(response)
Then status <statusCode>
And match $ contains payload.response.portedHistory
Examples:
| Scenario | statusCode |
| ABC.json | 200 |