Be aware that Gatling can use two levels of string interpolation.
In documentation and different tutorials, we warn about not using the scala string interpolator (string prefixed with an s) because it is hard to mix with Gatling EL.
In your case, you want to transform the string with an environment variable.
Two available solutions come in mind:
Give the variable to session
val login = sys.env(“PORTAL_ADMIN”)
val step =
exec(session => session.put(“myLogin”, login))
.exec(http(“my request”)
.body(StringBody("""{“user”:"${login}"}""")).asJson)
Note that it is close to your solution but with the session modification extra step.
Yes, it does.
I’m using now your first solution .
Just changed put to set and use new session variable.
Thanks again) exec(session => session.set(“myLogin”, login))