Expected 404s and Gatling

Published: November 1, 2019

Tags:

For many websites, for one reason or another (bots?), a not insignificant amount of traffic winds up hitting a 404 page. When load testing a website like this it is important that this traffic is represented for an accurate simulation.

With Gatling, by default a 404 response code is interpreted as a “KO”. But in this case the 404 is expected and should not be represented as a failure in Gatling’s reports.

We can tell Gatling the 404 status is expected by adding .check(status.is(404)) to the request.

Here’s a full example:

val scn = scenario("Scenario 1")
    .exec(http("request_1")
        .get("/404")
        .check(status.is(404)))

Max Chadwick Hi, I'm Max!

I'm a software developer who mainly works in PHP, but also dabbles in Ruby and Go. Technical topics that interest me are monitoring, security and performance.

During the day I solve challenging technical problems at Something Digital where I mainly work with the Magento platform. I also blog about tech, work on open source and hunt for bugs.

If you'd like to get in touch with me the best way is on Twitter.