How can I fail the simulation if gatling can't build a request (eg: a session attribute used in the request is null)

In my situation, I need to use a session attribute to build a get request. If the session attribute is null, gatling fails with “Failed to build the request” without marking this request as KO

In my assertions, I was using “assertions(forAll.failedRequests.count.lt(1)” which doesn’t catch the above error and Jenkins shows the simulation is passed. So how can I fail the simulation?

`

I have the same issue. Please write if someone has a solution.

Regrads,
Andras

How about using ‘doIfOrElse’ to check if the session attribute is set and if not execute an on purpose failed http request. In this way at least you can see right failed number in the report.

doIfOrElse(session => session("attr").asOption[String] != None) {/* the normal execution path you will use */} {/* the on purpose fail execution */ http("On purpose fail caused by attr not set") .get("http://www.google.com") .check(status.is(999)) }

The report would look like: