How to manage dependent steps?

Currently, Gatling has all the tools needed to make this work, but I’m wondering if there is a more elegant way.

Basically, I construct a Simulation with multiple HTTP calls. We are attempting to make each “step” modular by keeping them in their own objects, and we use, for example:

chain.insertChain(PrepareNewUser.step).insertChain(Register.step).insertChain(VerifyEmail.step).insertChain(Signon.step)

The problem is that each step really is dependent upon the previous one completing successfully. In a loaded environment, sometimes the responses do not come back in a timely manner. That is, if the Register step doesn’t complete, the VerifyEmail and Signon steps will necessarily fail.

I’d like to see something that basically says the VerifyEmail step should only be run if the Register step was successful. I can hack around this by doing something like:

Register.step:

chain.exec(http(“register”).get(…).check(status.is(201).saveAs(“stepSuccess”))

VerifyEmail.step:

chain.doIf((session:Session)=>session.getBoolean(“stepSuccess”),
chain.exec((session:Session)=>session.removeAttribute(“stepSuccess”))
.exec( http(“VerifyEmail”).get(…).check(status.is(200).saveAs(“stepSuccess”) )

Naturally, this introduces a lot of noise and a lot of boilerplate. Is there a more elegant way to do this?

That’s more or less the hack I described here:
https://github.com/excilys/gatling/wiki/Retry

Maybe we could add a global exitWhenFail parameter somewhere and include retry into the DSL.

Stay tuned.

2012/9/5 Dustin Barnes <dustin.barnes@gmail.com>