Then, in order to add a cookie to the CookieJar so it’s automatically sent, there’s a addCookies action: https://github.com/excilys/gatling/wiki/Gatling-2#wiki-http-misc

The thing is it’s quite complex to use in 2M3a, so it has been refactored in master/upcoming M4:

Indeed, I guess that I could do a
.exec(addCookie(“session-id”, “${test}”))

Is there a quick way to get some kind of nightly build?


Yep, snapshots are on Sonatype:

Regarding addCookie, see method signature here:

I got the snapshot from https://oss.sonatype.org/content/repositories/snapshots/io/gatling/gatling-bundle/2.0.0-SNAPSHOT/

I added 2 libs logback- classic and core
I had to comment out

// import io.gatling.http.Headers.Names._
// import io.gatling.http.Headers.Values._
// import bootstrap._

// import assertions._

but I still have an error:

GATLING_HOME is set to “C:\Programs\Gatling”
18:20:50.084 [ERROR] i.g.a.ZincCompiler$ - C:\Programs\Gatling\user-files\simulations\se\box\browse.scala:139: not found: value atOnce
18:20:50.087 [ERROR] i.g.a.ZincCompiler$ - setUp(scn.inject(atOnce(1 users),
18:20:50.088 [ERROR] i.g.a.ZincCompiler$ - ^
18:20:50.103 [ERROR] i.g.a.ZincCompiler$ - one error found
Compilation failed


OK getting the right bundle.

Still have to:

  • Add logback- classic and core from previous Gatling lib.
  • Remove the examples (compilation errors)

Then it worked !

.queryParam(“action”, “login”)
.exec( session => {
import io.gatling.http.cookie._
import java.net.URI

val ck = session(“gatling.http.cookies”).as[CookieJar].get(URI.create(“http://bdist/access”)).find(
_.getName == “session-id”
session.set(“test”, ck.getOrElse(null).getValue)
addCookie(“session-id”, “${test}”) // Default to path=/

But I also found out that I don’t need this anymore !?
With 2.0.0M3 the path was “/access” (were I got the cookie)
With the Snapshot, the path is “/”

Note that it is fine for me.

Thanks a lot.