Calling "arbitrary" functions


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?

André Silva

Hi André,

See Session 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))



2012/5/7 André Silva <>

Hello Stéphane,

That worked great, just as expected!
Appreciate your help.

André Silva

Good to hear.

2012/5/8 André Silva <>