我对以下回复的验证感到困惑 .
当我使用空手道发出get请求时,我得到以下响应,我想验证它 .
My Response is: {
"response": [
{
"tagName": "CaseTag",
"value": "CaseTagMckAuto_TagValueOne",
"entityType": "Case",
"partitionId": 1,
"appId": 1,
"id": 46,
"tagId": 1,
"entityId": 1
},
{
"tagName": "CaseTag",
"value": "CaseTagMckAuto_TagValue",
"entityType": "Case",
"partitionId": 1,
"appId": 1,
"id": 45,
"tagId": 1,
"entityId": 1
}
]
}
我试过了:
And match response[0].tagName contains ['CaseTag']
Then match each res contains
...
{
{tagName: 'CaseTag', value: 'CaseTagMckAuto_TagValueOne',
entityType: 'Case', partitionId: 1, appId: 1,id: 46,
tagId: 1, entityId:1}
}
...
And match response[0] == {tagName: 'CaseTag', value:
'CaseTagMckAuto_TagValueOne', entityType: 'Case', partitionId: 1,
appId: 1,id: 46, tagId: 1, entityId:1}
All three statements fails json it is not valid json array when i try giving
And match response == {tagName: 'CaseTag', value:
'CaseTagMckAuto_TagValueOne', entityType: 'Case', partitionId: 1,
appId: 1,id: 46, tagId: 1, entityId:1}
它说它不是String . 你能帮我验证一下吗?
1 回答
看起来你对嵌套感到困惑 . 这是一个适合我的示例,只需将其粘贴到一个功能文件中,无需HTTP:
了解您的JSON如何在其中包含
response
. 如果确实如此,那么在使用match
之前执行此操作,使其与上面的内容一样: