Karate notpresent关键字在空手道中不起作用

Karate notpresent关键字在空手道中不起作用,karate,Karate,我试图断言一个键不在JSON响应中。这就是答案 { "_type": "UserAccount", "accountName": "Account_Name", "accountType": "regular", "whiteList": true, "sfAccountId": "1", "preferredLanguage": "english", "imageSize": "highRes", "_id": "775a8

我试图断言一个键不在JSON响应中。这就是答案

   {
    "_type": "UserAccount",
    "accountName": "Account_Name",
    "accountType": "regular",
    "whiteList": true,
    "sfAccountId": "1",
    "preferredLanguage": "english",
    "imageSize": "highRes",
    "_id": "775a8451-6a07-42da-a199-fe98f44bdc06"
}
我已经根据文档和来自的回答尝试了这两个步骤

然而,这是我在上面的第一步中不断遇到的错误

com.jayway.jsonpath.PathNotFoundException: No results for path: $['appClientId']
第二步呢

com.intuit.karate.KarateException: path: $, actual

提前感谢

可能您的版本已过时,以下内容在0.9.1中适用于我:

* def response =
"""
{
    "_type": "UserAccount",
    "accountName": "Account_Name",
    "accountType": "regular",
    "whiteList": true,
    "sfAccountId": "1",
    "preferredLanguage": "english",
    "imageSize": "highRes",
    "_id": "775a8451-6a07-42da-a199-fe98f44bdc06"
}
"""
* match response.appClientId == '#notpresent'
* match response contains { appClientId: '#notpresent' }

我们目前正在使用v0.8.0,该版本是否不支持此功能?@Ilan_p我认为0.9.0中的一些错误修复与此相关以下步骤
*匹配响应包含{appClientId:'#notpresent'}
满足我的需要,也不需要更新到v0.9.1
* def response =
"""
{
    "_type": "UserAccount",
    "accountName": "Account_Name",
    "accountType": "regular",
    "whiteList": true,
    "sfAccountId": "1",
    "preferredLanguage": "english",
    "imageSize": "highRes",
    "_id": "775a8451-6a07-42da-a199-fe98f44bdc06"
}
"""
* match response.appClientId == '#notpresent'
* match response contains { appClientId: '#notpresent' }