Gatling DSL components are immutable ActionBuilder(s) that have to be chained altogether and are only built once on startup. The results is a workflow chain of Action(s). These builders don’t do anything by themselves, they don’t trigger any side effect, they are just definitions. As a result, creating such DSL components at runtime in functions is completely meaningless.
If you want to do string interpolation with the session attributes, there is the expression language for that.
Since the variable is in the session, first you need to get it to a local variable (Scala variable) and then pass the scala variable to your custom function.
.exec { session =>
println("**********************deployToCF:" + session("deployToCF").as[String] ) --> prints the correct value:
Your guess is correct. The signature of runCommand is String, String.
By sending it with runCommand ("${deployToCF}", “deploy MTAR to CF”)) I expect Gatling compiler to convert it to the value, but it does not happen