I want to assert values in json response from csv file. Is that possible in karate?
I have around 1200 codes in my response and I want to validate them against CSV file. I used read('Code.csv') but seems like it only works for single row. Do we need to add any iterator?
Code snippet:
- def codeValue = karate.jsonPath(response, "$..code..CodeValue")
- def codes_expected = read('Code.csv')
- match codeValue contains only codes_expected
Response:
{
"code": {
"AB": [
{
"CodeValue": "OI"
}
],
"CD": [
{
"CodeValue": "NO"
},
{
"CodeValue": "CS"
},
{
"CodeValue": "DE"
}
],
"TX": [
{
"CodeValue": "IO"
},
{
"CodeValue": "ZC"
},
{
"CodeValue": "FO"
}
]
}
}