【问题标题】:"Found nothing" error with JSONPath filter and gatlingJSONPath 过滤器和 gatling 出现“找不到任何东西”错误
【发布时间】:2015-03-20 14:15:47
【问题描述】:

我正在尝试用绿色蔬菜过滤这个 JSON:

[
    {
        "vegetable": {
            "name": "peas",
            "color": "green"
        },
        "meet": {
            "name":"beef",
            "color":"red"
        }
    },
    {
        "vegetable": {
            "name": "potato",
            "color": "yellow"
        },
        "meet": {
            "name":"lamb",
            "color":"brown"
        }
    }
]

带有类似加特林的 JSONPath

val searchGreenVegetable = exec(http("Search green vegetable")
                                  .get("http://myUrl/json/")
                                  .check(jsonPath("""$..vegetable[?(@.color=="green")]""").exists)
                           )

但我总是在 gatling 报告中出现“未发现”错误。

【问题讨论】:

    标签: json jsonpath gatling


    【解决方案1】:

    你的表达是正确的,这确实是bug。 它在刚刚发布的 0.6.3 中修复。

    感谢您的报告。

    【讨论】:

      【解决方案2】:

      试试这个:

      val searchGreenVegetable = exec(http("Search green vegetable")
                                        .get("http://myUrl/json/")
                                        .check(jsonPath("$..vegetable[?(@.color=='green')]").exists)
                                 )
      

      【讨论】:

      • 感谢您的回复!但它不起作用,我仍然有同样的错误。
      • @kalle Gatling 不使用您的实现,而是我们自己的。
      猜你喜欢
      • 2021-04-08
      • 2022-01-23
      • 2018-05-17
      • 2012-07-04
      • 1970-01-01
      • 2010-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多