Caching issue & How do I check the redirect status instead of the final one

Hello Community,

I’m pretty new to Gatling and Scala so I’ve some iusses with them.

I’ve a simple API which I can call. After the call I’ll get a “302” redirect to the “success” page. Here are my two questions:

  1. How do I check for a redirect? I expected to get the status 302 back if I make a check but I’ll always get a 200 which is the final status. I would like to have something like: If you get a 302 with RedirectURL “xy” go on.

  2. I did run the script and get around 44000 rpm on the first request but only 144 at the redirect. Edit: It seemed like a caching issue. I disabled caching after this and it looks good so far.
    But why did I get 144 redirects with caching enabled? Should’nt it be 500, for each user one?

`
val httpProtocol = http
.baseURL(“baseURL”)
.acceptHeader("/")
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36”)
.disableCaching

val scn = scenario(“microservice”)
.during(120 seconds){
exec(http(“REST”)
.get("/?contact_email=test%40xyz.de")
//.check(status.in(302 to 304)) → fails
.check(regex(""“Success”"")))
.pause(100.milliseconds)
}

setUp(scn.inject(rampUsers(500) over (60 seconds))).protocols(httpProtocol)
}
`

Thanks in advance and greetings from Germany :slight_smile:

PS: Using gatling 2.2.5 at the moment.