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?
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)) }