I am looking for a solution to assert a json response in karate dynamically and maintain the data differently for each test case. Below is the example response:
[{
"id": "Level 1 id",
"name": "Name 1",
"description": [{
"locale": "locale 1",
"description": "description 1"
},
{
"locale": "locale2",
"description": "description2"
}
],
"type": "type1",
"Value": 100.0,
"ObjectType": "test123",
"Object": [{
"id": "1",
"groupName": "OBJECT1",
"filterCriteria": "filter1",
"TypeMethod": "method1",
"nGroup": "AND1",
"criteria": [{
"name": "multiple objects but no arrays"
},
{
"name": "multiple objects but no arrays"
},
{
"name": "multiple objects but no arrays"
}
]
},
{
"id": "2",
"groupName": "OBJECT2",
"filterCriteria": "filter2",
"TypeMethod": "method2",
"nGroup": "AND2",
"criteria": [{
"name": "multiple objects here but no arrays"
},
{
"name": "multiple objects here but no arrays"
},
{
"name": "multiple objects here but no arrays"
},
{
"id": "3",
"groupName": "OBJECT3",
"filterCriteria": "filter3",
"TypeMethod": "method3",
"nGroup": "AND3",
"criteria": [{
"name": "multiple objects but no arrays"
},
{
"name": "multiple objects but no arrays"
},
{
"name": "multiple objects but no arrays"
}
]
}
]
}
]
}]
I want to assert id, name, description and the Object array whose values change based on different id's. I am aware about schema approach but i need to assert on specific values. I have also tried match feature by keeping json files for each test case but that becomes difficult to maintain in different test environments. Can somebody help me with the best approach to assert and how can the test data be maintained.