简体   繁体   English

如何在Gatling ReponseProcessor中消除警告

[英]How can I elminated warnings in Gatling ReponseProcessor

I have some code in my scenario such as 我的场景中有一些代码,例如

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

but I keep getting the following 但我不断得到以下

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

Is there some way I can construct my checks so that I don't get these messages, because I am already handling both cases? 有什么方法可以构造我的支票,以使我不会收到这些消息,因为我已经处理了两种情况?

I have tried several variations, but nothing seems to work. 我尝试了几种变体,但似乎没有任何效果。

Okay, this does what I want (mostly) 好的,这就是我想要的(主要是)

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

I say mostly because while it solves one problem, it creates another. 我说的主要是因为它解决了一个问题,却创造了另一个问题。 Basically the 400 and 500 errors are captured, but now they are not marked as KO, so the statistics don't count them. 基本上捕获了400和500个错误,但是现在它们没有标记为KO,因此统计信息中没有对它们进行计数。 I tried explicitly returning 我尝试明确返回

sesson.markAsFailed

in my exec(), but that does not work, probably because once you are out of the check, the failure does not count (pun intended). 在我的exec()中,但这不起作用,可能是因为一旦您超出检查范围,失败就不算(双关语)。

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

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