I have a scenario where a portion of the api response is the response from another api (an api A intern calls another api B). But the response array elements interchange their position in each hit, but the elements are same, only the order changes. In my master feature file im calling api B and doing the validation in a loop like below. But because of the order issue karate.match
fails. Is there a way I can use karate.contains
? or any other work around for this?
* def apib = call read('apib.feature') __row;
* def xyz =
"""
function(response,apib,status){
if (status == 200){
if (karate.sizeOf(apib.response.members) > 1){
for (i = 0;i < karate.sizeOf(apib.response.members); i++){
karate.match(response.member.id[0].covered[i].Uid, apib.response.members[i].member.Uid);
}
}
}
}
"""
* def apib = all.responseStatus
* def var = xyz(response,apib,status)