首页 > 解决方案 > 当空手道 jsonpath 的数组为空时,验证失败

问题描述

问题在于验证。在这里,当我运行测试时,两个验证都通过了,但我可以在响应中看到它们,价格为 null ( price[])。我的疑问是originalPrice当价格数组本身为空时它是如何发现的。
在验证中,我有以下内容:

And matchResponse.data.abc[].price[] == '#array'
和 match Response.data.abc[].price[].originalPrice == '#present'

Sample response:
 "data": {
    "abc": [
 "abcnumber":001,
 "price": [],
]}

标签: validationkaratejson-path-expression

解决方案


推荐阅读