Gatling - 使用 JsonPath 检查多个值

Gatling - Check multiple values with JsonPath

我正在使用 Gatling 2.1.7,但找不到使用 JsonPath 检查多个值的方法。

假设我有这个 Json:

{
  "messageTyp": "wsopen",
  "userId": "1" 
}

我确实需要检查这两个值。 很容易检查值:

.check(wsAwait.within(2).expect(1).jsonPath("$..messageType").is("wsopen"))

但是因为此测试是 运行 在 "feeder" 循环中,所以有很多 "wsopen" 消息,异步返回。我需要检查每个用户是否都收到了一条 "wsopen" 消息。

我需要类似的东西

.check(wsAwait.within(2).expect(1).jsonPath("$..messageType").is("wsopen").and.jsonPath("$..userId").is("${userid}")) // won't compile

有人提示吗?

你可以直接用JSONPath来完成:

jsonPath("$[?(@.messageTyp=='wsopen' && @.userId=='1')]").exists