[GATLING 2]: EvaluatableString lost

Hi all,
We are currently trying to migrate some protocol code from Gatling 1.5.x to Gatling 2.x.
Lots of our code were using the EvaluatableString in the following manner:

class MyAction(actionName: EvaluatableString) extends Action() {

def execute(session: Session) {
val my = actionName(session)


We are a bit disappointed (as we are not Scala experts) on how the above code is translated in Gatling 2.
May be, we were wrong while using EvaluatableString too.

Thanks in advance!

EvaluatableString has been replaced by Expression[String] (you’ll guess that it can now handle other types than String):

If you can post a gist of your code, I can show you how to migrate.


Here it is:

The more I am looking at the code, the more I am wondering whether we were using EvaluatableString in the proper manner and whether a String would have suffice.
Apologize again we are right now Scala newbies.

Thanks in advance!

That’s pretty good actually!
Here’s my fork for Gatling 2: https://gist.github.com/slandelle/f5a9fec439e2356946de

See comments in code.
Also note that the preferred way (when having some Scala skills) to work with Expressions and session attributes is to use the Validation monad.

You can then combine several Validations, for example resolving an Expression and getting a session attribute with a for comprehension: https://gist.github.com/slandelle/f5a9fec439e2356946de#file-gistfile1-scala-L46

I hope I’m being clear.

Wow! Thanks for the work!

I am not sure but with your gist code, I have a compilation errors for ProtocolRegistry and for “aSession(channelName).validate[ActorRef]” but I guess this is due to the fact I am working with the 2.0.M2 and your code is probably for a trunk version of Gatling 2.

Anyhow even when fixing them with backward compatible, I still have compilation errors when calling session against an expression like on https://gist.github.com/slandelle/f5a9fec439e2356946de#file-gistfile1-scala-L55. Scala IDE gives me a “type mismatch; found : io.gatling.core.validation.Validation[String] required:

Am I missing something like an implicit import of a scala function? I can’t figure out the error.

Sorry to bother again for a little bit more help…
Thanks in advance,


PS1: for https://gist.github.com/slandelle/f5a9fec439e2356946de#file-gistfile1-scala-L27, I’ve written a little bit different code based on what I saw for the gatling http module: https://gist.github.com/ctranxuan/20004abadafba409cad2#file-gistfile1-scala-L26. Am I wrong or is it the new way for Gatling 2?
PS2: thanks for your explanation and the code, I start to understand a little bit the Expressions stuff… I am still getting hard day with the Validation monad but I will look for some code to grap it.

Yep, my gist is against the latest master (my code definitively compiles).
We plan on releasing M3 within a week, so you’d better wait a bit, or use the snapshots in our Cloudbees CI: https://github.com/excilys/gatling/wiki/Continuous-Integration

And feel free to ask anytime, we’re eager for feedback on the new APIs and the migration path.


Using a String or an Expression[String] is up to you. It depends if you want this property to be dynamic/per user, or static.

OK! Many thanks!
We will probably switch to the snapshots.

Thanks again!