Gatling does not fail the Gradle task with errors, thus we have a successful build

Hi, community,

I saw that if I make a bunch of checks for requests, for example, the most popular one, check the status code 200 OK, or some slightly different ones, parsing a response body and looking for specific values. So, these errors exist at the end of the stack trace, and in general, in the report, anyone can see these errors, but these errors do not fail the Gradle task in any way. That is the Gradle task has the exit status - 0. That is a successful “build”.

exec(
  getAccessTokenRq()
    .check(status().is(Status.OK))
    .check(jsonPath("$.token").saveAs("token"))
);

For some reason, I thought that, for example, these checks, which go immediately after the request, should also fail the Gradle task. But - no.

The only one configuration that fails the Gradle task is if I add assertions in the simulation, these assertions fail the build 100%.

Can someone please help me understand what setting to pass to Gatling so that when there are errors from the checks, it sends the status code - 1 to Gradle? Regardless of the number of those errors, even if there is 1 error - the build should be failed.

  • Gradle higher - 7 version
  • Gatling Gradle plugin - id 'io.gatling.gradle' version '3.8.3.2'
  • Java 17

Thanks!

Oh, I added assertions like this

.assertions(
  forAll().failedRequests().percent().lte(0.1)
);

And it seems that this is what I actually need. Now if I have an error for a request, then with the corresponding percentage I have a failed Gradle task.