繁体   English   中英

如何在Gatling ReponseProcessor中消除警告

[英]How can I elminated warnings in Gatling ReponseProcessor

我的场景中有一些代码,例如

.check(status.is(200), jsonPath("$['resultData'][*]['@contentType']").findAll.saveAs("resultData")) 
.check(status.is(500), jsonPath("$['processingError']").find.saveAs("processingError"))

但我不断得到以下

10:36:51.946 [WARN ] i.g.h.a.ResponseProcessor - Request 'GetAllThings' failed: status.find.is(200), but actually found 500
10:36:52.344 [WARN ] i.g.h.a.ResponseProcessor - Request 'GetAllThings' failed: status.find.is(500), but actually found 200

有什么方法可以构造我的支票,以使我不会收到这些消息,因为我已经处理了两种情况?

我尝试了几种变体,但似乎没有任何效果。

好的,这就是我想要的(主要是)

.check(
  status.in(Seq(200, 400, 500)),
  jsonPath("$['resultData'][*]").findAll.optional.saveAs("resultData"),
  jsonPath("$['processingError']").optional.saveAs("processingError")
)

我说的主要是因为它解决了一个问题,却创造了另一个问题。 基本上捕获了400和500个错误,但是现在它们没有标记为KO,因此统计信息中没有对它们进行计数。 我尝试明确返回

sesson.markAsFailed

在我的exec()中,但这不起作用,可能是因为一旦您超出检查范围,失败就不算(双关语)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM