Hi,
I'm looking for a way to call Scala functions, that are defined by me,
during the execution of a scenario. For example, during a scenario I
need to generate user IDs. The only way I've been able to do this is
to use the feeders API. Still, it seems inefficient to generate csv/
tsv files when the data I need can be simply generated on-the-fly
(e.g. the userid might be a random number).
Is there any way to do this?
Regards,
André Silva
Hi André,
See Session functions:
https://github.com/excilys/gatling/wiki/Session#wiki-functions
So you could do something like:
val random = new java.util.Random
val scn = scenario(“MyScenario”)
.exec((session: Session) => session.setAttribute(“userId”, “user” + random.nextInt))
Cheers,
Steph
2012/5/7 André Silva <andre.beat@gmail.com>
Hello Stéphane,
That worked great, just as expected!
Appreciate your help.
Regards,
André Silva
Good to hear.
2012/5/8 André Silva <andre.beat@gmail.com>