Is there any way to instruct Gatling to stop a scenario after the first KO?

Hi all,

I am trying to find an efficient way of stopping a scenario right after an error occurs since it makes no sense in littering the report with errors, which are only caused by a single failed step in the chain of calls.

My scenario looks like this (snippet):

override def scenario =
  AccountCreate.create.exitHereIfFailed
    .exec(AccountLogin.login().pause(1 seconds).exitHereIfFailed
      .exec(AccountActivate.activate.exitHereIfFailed

So far, I identified three possible options for the execution:

  1. Execute the scenario, skip the erroneous step, move on with the next one (this is the default behaviour).
    *** Unfortunately, it litters the report with irrelevant errors and makes it harder to debug and analyse.
    For example, failing to log in to an app will cause a cascade of unauthorized errors to pour in.
    I read Stephane’s reasoning that in a real-world scenario a user is likely to retry to log in, however I find it easier to control the load on the server just by spawning one more user anew.

  2. Execute the scenario with each call completed with the exitHereIfFailed statement (shown above):
    *** Does the job well and as expected, however it is incredibly cluttered (imagine you have N calls, they you also need to add N exitHere… statements).

  3. Execute the scenario within the exitBlockIfFails wrapper:
    *** Clean approach, but does not work with the ScenarioBuilder.
    The biggest gripe with it is actually that the failed scenario step is not included to the output/report.
    And that the simulation is marked as success and has exit code 0. (looks rather like a defect to me)

I am new to Scala and Gatling, perhaps, I misunderstand the approaches? I appreciate any comments.

Anyone, please?

I once used tryMax{}.exitHereIfFailed, it will retry once KO ocurrs then exit when all retry time as defined, it will skip the following test cases.

在 2016年10月27日星期四 UTC-7上午2:22:18,Eugene Abramchuk写道:

Solved (kind of) by moving .exitHereIfFailed to all the actions inside.