空手道 - 无法执行匹配操作 - 实际值不是字符串

问题描述 投票:1回答:1
Scenario Outline: Verify retreiving endpoint for particular system
  Given path 'kites/<id>'
  When method get
  Then status 200
  And match response contains "<orgid>"

  Examples:
    | kites                    | orgid                    |
    | 56338e32e4b0846c32c0732e | 56338e32e4b0846c32c0732e | 

我收到以下错误:

com.intuit.karate.exception.KarateException: path: $, actual:
{
     "orgId": "56338e32e4b0846c32c0732e",
     "name": "Supplier Management"
}
expected: '56338e32e4b0846c32c0732e', reason: actual value is not a string

我试过<orgid>"<orgid>",但我得到了同样的错误。任何帮助,将不胜感激。

karate
1个回答
2
投票

你的例子里有很多我不理解的东西。 <id>来自哪里? kites柱在哪里使用?

最严重的问题是你使用的是orgid,但实际的JSON有一个关键的orgId。请不要犯下基本错误,然后再试一次。

你不应该尝试做这样的事情:

And match response contains { orgId: "<orgid>" }

编辑:由于有关于上述(我觉得令人失望)的投诉,我正在添加另一个选项:

And match response.orgId == "<orgid>"
© www.soinside.com 2019 - 2024. All rights reserved.