空手道-实际值不是字符串

时间:2018-12-13 10:53:55

标签: karate

作为响应,我正在检查'OK'参数,但遇到上述错误。相同的代码正在使用我以前的空手道版本,现在使用的是0.9.0-这可能是我的编码出现问题,无法弄清。

响应:

"testResponse": {
    "planSummary": {
      "includedServicesList": [
          {
            "some elements goes here": "test"
          }
        ],
      "status": {
        "statusCd": "200",
        "statusTxt": "OK"
      }
   }
}

我的功能文件代码:

When method get
Then status 200
Then match response contains 'OK'

我收到expected: 'OK', reason: actual value is not a string错误。

我也尝试过Then match response contains {statusTxt: 'OK'}

1 个答案:

答案 0 :(得分:2)

您可以尝试一下,

* match response.testResponse.planSummary.status contains {'statusTxt' : 'OK'}

OR

* match response.testResponse.planSummary.status.statusTxt == 'OK'