繁体   English   中英

如何忽略加特林中失败的请求

[英]How to ignore the failed request in Gatling

我有一个加特林性能脚本来测试注销页面。 进入主页后,我将请求发送到注销页面。 https://..../logout.html的请求为200 OK。

.exec(http("getHomepage")
                .get("https://.../home/home.jsp")
                .silent
                .check(status.find.in(200))
                .check(bodyString.saveAs("responseBody"))
                .headers(headers_1))
              .exec(http("getLogoutPage")
                .get("https://..../logout.html")
                .headers(headers_1))

但是,当调用GET https://..../logout.html时 ,它还会有其他一些请求,例如.js,.css,.png。 其中一些得到404。

>getLogoutPage                     (OK=14     KO=0     )
>XD-IMG-Warn.png                   (OK=0      KO=13    )

错误:

[WARN ] ighaResponseProcessor - Request 'XD-IMG-Warn.png' failed: status.find.in(200,304,201,202,203,204,205,206,207,208,209), but actually found 404 XD-IMG-Warn.png的错误并不重要,我只关心getLogoutPage结果。 所以我的问题是在运行测试期间如何忽略此错误?

对于您不关心结果的请求,您可以将它们标记为静默,这样它们就不会包含在报告中,也不会导致KO。

为此,您可以在不希望报告的任何请求后仅链接.silent

https://gatling.io/docs/2.3/http/http_protocol/#http-protocol-silencing中的文档中详细介绍了

暂无
暂无

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

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