Karate 场景示例中的jsonPath

Karate 场景示例中的jsonPath,karate,Karate,有人能帮我做以下事情吗 在场景大纲示例中是否可以使用json路径表达式 场景大纲:验证路径和描述 Given url When method GET * match <path> == <description> Examples: |path|description| |$.parent.child.description|"First child"| 给定url 当方法得到 *匹配== 示例: |路径描述| |$.parent.child.description

有人能帮我做以下事情吗 在场景大纲示例中是否可以使用json路径表达式

场景大纲:验证路径和描述

Given url
When method GET
* match <path> == <description>

Examples:
|path|description|
|$.parent.child.description|"First child"|
给定url
当方法得到
*匹配==
示例:
|路径描述|
|$.parent.child.description |“第一个孩子”|

是,请参见下面的示例:

Scenario Outline:
* def response = { foo: '1', bar: '2' }
* match <path> == '<expected>'

Examples:
| path  | expected |
| $.foo | 1        |
| $.bar | 2        |
场景大纲:
*def响应={foo:'1',bar:'2'}
*匹配=“”
示例:
|路径|预期|
|$.foo | 1|
|$.bar | 2|
但我强烈建议您不要尝试做这种“聪明的事情”,因为它会导致长期的可维护性问题。有关我所指内容的示例,请参见以下示例:

空手道非常擅长在一个步骤中匹配整个JSON,您将失去这一优势。您的示例还有一个严重的问题,因为它将对表中的每一行发出GET请求

因此,请尽可能为每个要测试的“流”编写一个
场景。不要把东西组合得太多。我是凭经验说的:)