为什么 Gatling 在有效的 jsonpath 上失败?

Why is Gatling failing on a valid jsonpath?

我在返回的正文中有以下 .check:(出于安全原因我更改了值,但结构相同)

 .exec(http("Get ids")
          .post("GetIds")
          .body(ElFileBody("json/getIds.json")).asJson
          .check(jsonPath("$...Types..[?(@.Type == 'web')].id").findAll.saveAs("IDLlist"))

但是交易失败 "Gettting findAll.exists extraction crashed: end of input expected when trying to extract values from a returned body"

Gatling 打印失败交易的主体,当我将交易刚刚失败的确切主体带到 http://jsonpath.com/ 并且 评估刚刚失败的 jsonpath,我得到了没有问题的好结果。这意味着返回的正文是正确的,并且 jsonpath 也是正确的。 那问题是什么?

你的 JSON 路径语法似乎有误 --> "$...Types..[?(@.Type == 'web')].id"

尝试使用 JSONPath Online Evaluator -- http://jsonpath.com/ 找到正确的 json 语法

感谢 Gatling 论坛的 Stephane,我发现 $..Files[?(@.Format == 'DASH_Web')].URL 是正确的,而不是我的变体有。

由于 http://jsonpath.com/ 能够使用我的原始语法提取正确的路径,我认为重要的是要注意 Gatling jsonpath 在其语法上要保守得多。