Cookie & Session is getting copied as-is instead of a variable, which changes with every new login

I am new to Gatling and currently using version 2.1.4, I am using it against JIRA Application.

I am trying to record a session in which it creates a ticket, now when I am looking at the scala script, then instead of cookie getting stored and used, the value is hardcoded from my previous recording session.
Due to which, application is unable to create a ticket using simulator.

Sample Request :

.exec(http(“request_74”)
.post("/secure/QuickCreateIssue.jspa?decorator=none")
.headers(headers_25)
.formParam(“pid”, “14418”)
.formParam(“issuetype”, “49”)
.formParam(“atl_token”, “BW71-6DCW-73FP-8JMC|64bd1d3cab0ce4563e7215747a639b0341852651|lin”)
.formParam(“formToken”, “021d92d670801e91eecdfbbfd1f6c7af7953c992”)
.formParam(“customfield_12201”, “17422”)
.formParam(“components”, “nv_test”)
.formParam(“summary”, “test”)
.formParam(“customfield_15004”, “18802”)
.formParam(“description”, “test”)
.formParam(“dnd-dropzone”, “”)
.formParam(“customfield_15005”, “”)
.formParam(“security”, “10600”)
.formParam(“customfield_11605”, “”)

A cookie is something that’s received from the server in a Set-Cookie header and sent back in a Cookie header.
Gatling automatically deals with cookies

This is not a cookie, it’s a token that’s somewhere in your HTTP response.

You’re the one in charge of capturing it. See documentation for checks and saveAs.

Thanks Stephane for replying back

Somehow I was able to retrieve alt_token and formtoken values and added them as variables.

Confirmed that these 2 variables are working correctly as well.
.exec(session => {
println(session(“atl_token”).as[String])
session
})
.exec(session => {
println(session(“formTokex”).as[String])
session
})

But still I am unable to simulate a ticket creation, I had also attached my scala simulation class.

Error message from JIRA logs

atlassian-jira.log:2015-04-06 16:02:43,040 http-bio-8443-exec-54 INFO gatling 962x38680x1 1twxlwt 10.54.XX.YY /secure/QuickCreateIssue.jspa [jira.web.action.XsrfErrorAction] The security token is missing for ‘gatling’. User-Agent : ‘Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0’

Any help is highly appreciated…

Thanks,
Sunil

RecordedSimulationDelete.scala (30.5 KB)

Except for logout (should be curly braces instead of parens), it looks good to me.

Ok… Thanks for trying Stephane

Maybe someone who had tried Gatling & JIRA might be able to help me out.