You don’t say that you have checked you’re using the latest version, if you’re using the Java or the Scala DSL, etc. As is, it’s impossible to help you.
package computerdatabase
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class BasicSimulation extends Simulation {
val httpProtocol = http
.baseUrl("http://computer-database.gatling.io") // Here is the root for all relative URLs
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") // Here are the common headers
.acceptEncodingHeader("gzip, deflate")
.acceptLanguageHeader("en-US,en;q=0.5")
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
val scn = scenario("Scenario Name")
.exec(session => session.set("foo", "bar"))
.exec(http("request_10")
.post("/computers")
.formParam("""name""", """#{foo}""") // EXPECT bar
.formParam("""introduced""", """2012-05-30""")
.formParam("""discontinued""", """""")
.formParam("""company""", """37"""))
setUp(scn.inject(atOnceUsers(1)).protocols(httpProtocol))
}
ran mvn clean gatling:test
observed that the substitution was properly triggered in the logs:
I deleted the simulation and recreated freshly because in IDE, scala 3.X version was configured. When I recreated, I could change to scala 2.X. It is mainly because of scala version.