简体   繁体   中英

How to ignore the failed request in Gatling

I have a Gatling performance script to test the logout page. After getting the home page, I send the request to logout page. the request for https://..../logout.html is 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))

But when calling GET https://..../logout.html , it will also have some other request like .js, .css, .png. Some of them get 404.

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

And the error:

[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 The Error for XD-IMG-Warn.png does not really matter, I only care about the getLogoutPage result. So my question is how to ignore this error during running the test?

for requests that you don't care about the results of, you can just mark them as silent so they are not included in reports and don't result in KOs.

to do this you can just chain .silent after any request you don't want reported

detailed in the docs at https://gatling.io/docs/2.3/http/http_protocol/#http-protocol-silencing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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