如何检查密钥是否具有不同的值
我遇到了检查特定键的问题。 例如,我有下一个响应
{
"content": [
{
"first_name": "Agent007",
"last_name": "007",
"id": "aa70d1c0-3de4",
"status": "INACTIVE"
},
{
"first_name": "ALEX",
"last_name": "Doe",
"id": "d9d5c211-5388",
"status": "ACTIVE"
}
]
}
如何检查每个“状态”是否具有“活动”或“不活动”值?
我尝试过,但它不起作用
And assert response.content[*].status == 'ACTIVE' || response.content[*].status == 'INACTIVE'
I faced problem with checking specific key.
For example I have the next response
{
"content": [
{
"first_name": "Agent007",
"last_name": "007",
"id": "aa70d1c0-3de4",
"status": "INACTIVE"
},
{
"first_name": "ALEX",
"last_name": "Doe",
"id": "d9d5c211-5388",
"status": "ACTIVE"
}
]
}
How to check if each "status" can have "ACTIVE" OR "INACTIVE" value?
I tried this, but it doesn't work
And assert response.content[*].status == 'ACTIVE' || response.content[*].status == 'INACTIVE'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是(只是)一种方法:
另一种方法: https:// github。 com/karatelabs/karate#match-ereach
,请参阅此答案以获取高级想法: /70055035/143475
This is (just) one way to do it:
Also refer the docs: https://github.com/karatelabs/karate#match-each
And see this answer for advanced ideas: https://stackoverflow.com/a/70055035/143475