我想执行以下操作:
post / getAnimalStatus响应:
"animals": [
{
"animalId": "567839",
"gender": "Female",
"age": 2,
"isEligibleAsPet": true,
"animalStatus": "AVAILABLE"
},
{
"animalId": "648562",
"gender": "Male",
"age": 3,
"isEligibleAsPet": true,
"animalStatus": "AVAILABLE"
},
{
"animalId": "965895",
"gender": "Female",
"age": 5,
"isEligibleAsPet": false,
"animalStatus": "UNAVAILABLE"
}
]
}
然后我想:
UNAVAILABLE
的动物并将数组值存储在变量中。animal
对象中使用来自上面响应的数组值。:put / updateAnimals
"animal": {
"animalId": "965895",
"gender": "Female",
"age": 5,
"isEligibleAsPet": false,
"animalStatus": "UNAVAILABLE"
},
"updateStatus": "AVAILABLE"
}
使用JsonPath(或karate.filter()
)进行操作:https://github.com/intuit/karate#jsonpath-filters
使用第二个特征文件和call
进行迭代:https://github.com/intuit/karate#data-driven-features
请提出更具体的问题,以获得更具体的答案。