Stop executing the scenario on check errors ?

4,266 views
Skip to first unread message

Nicolas R.

unread,
Apr 13, 2012, 1:51:37 PM4/13/12
to gat...@googlegroups.com
Hi,

Is there an option for saying that whenever a check fails, the execution of the scenario should stop for this particular user ? 

It happens that under load the login fails and then, of course, it doesn't make any sense to continue.

cheers
Nicolas

Stéphane Landelle

unread,
Apr 13, 2012, 2:54:31 PM4/13/12
to gat...@googlegroups.com
Hi Nicolas,

No there isn't such an option.

However, you're supposed to simulate user behavior. IMHO, if the login sometimes fails once under load, a typical user doesn't definitively give up, he... retries (and usually by clicking like crazy)!

Please see:

You can even add a pause in a "if" block that would only execute if the login failed.

WDYT?

Cheers,

Steph

2012/4/13 Nicolas R. <nicolas...@gmail.com>

Stéphane Landelle

unread,
Apr 13, 2012, 3:38:12 PM4/13/12
to gat...@googlegroups.com
But if you really insist on stoping this user, you can just the same way surround the rest of your scenario in a "doIf" block:

val scn = scenario("MyScenario")

.exec(http("Login").post("loginUrl").check(status.in(200 to 207).saveAs("authenticated")))

.doIf((s: Session) => s.isAttributeDefined("authenticated"), chain.exec(// rest of your scenario

))


2012/4/13 Stéphane Landelle <slan...@excilys.com>

Nicolas R.

unread,
Apr 16, 2012, 4:31:08 PM4/16/12
to gat...@googlegroups.com
The options are : 
1/ Continue the execution and ignore the errors
2/ Stop the script for the current user
3/ Retry

By default, we have 1/ but it's the only one that doesn't make so much sense to me. 

2/ & 3/ are much more interesting to me, but isn't that boilerplate code decreasing the code readability ? 


I think I would like to be able to express this behavior with something like :

 .exec(http("Login").post("loginUrl").check(status.in(200) ... ).retry(3).stopOnError

WDYT ?

Cheers
Nicolas

PS: Gatling is such an awesome tool !

Stéphane Landelle

unread,
Apr 16, 2012, 5:08:48 PM4/16/12
to gat...@googlegroups.com
Well, my 2 cents is that if you ask people about these 3 options, you will get 33,33% / 33,33% / 33,33%... 

Should "stopOnError" be a global config or specific to a given request?
Should "retry" be applied on a single request or a chain (for example, login is not necessarily a single request process, but can generate multiple requests, like with CAS)?

Complex topic actually...

"retry" and "stopOnError" built-ins could be good ideas, but I'd rather not rush but take time to make sure they're indeed good ones.
Introducing something in the DSL (which is our public API) is something we want to carefully design. We broke some things between 1.0 and 1.1 because of design mistakes and it was painful for some users.
The best way to have this topic move forward is having other people joining in the discussion ("hey, anybody here???").

Thanks!

Steph

2012/4/16 Nicolas R. <nicolas...@gmail.com>
328.png

Nicolas Rémond

unread,
Apr 17, 2012, 5:06:57 AM4/17/12
to gat...@googlegroups.com
No rush for me and I fully agree that any DSL changes should be discussed ;)

>Should "stopOnError" be a global config or specific to a given request?
I would think both :p

>Should "retry" be applied on a single request or a chain (for example, login is not necessarily a single request process, but can generate multiple requests, like with CAS)?
In case of a chain, I would think that the "retry" only applies on the last request.

More people interested in this topic ?

Nicolas

stéphane

unread,
Nov 5, 2012, 12:39:30 PM11/5/12
to gat...@googlegroups.com
Hy

any news from this parameter?

For me it will be interesting to provide the possibility of stoping a user whene an error occures. (global parameter StopOnError)

in complex scenarios, it could be great when your using big dataset, to stop thoses who failed beacause of none valid data.

Stéphane

Stéphane Landelle

unread,
Nov 5, 2012, 1:04:42 PM11/5/12
to gat...@googlegroups.com
Just surround your whole scenario with a exitBlockOnFail:

Cheers,

Stéphane


2012/11/5 stéphane <verti...@gmail.com>

stéphane

unread,
Nov 12, 2012, 3:37:37 AM11/12/12
to gat...@googlegroups.com
thanks
Reply all
Reply to author
Forward
0 new messages