addCookie not work

915 views
Skip to first unread message

jilen nil

unread,
Jun 24, 2015, 6:24:03 AM6/24/15
to gat...@googlegroups.com
Code

 

val scn
= scenario("TicketSimulation")
   
.exec(addCookie(Cookie(key, value)))
   
.exec(http("ticket_get").get("some url"))



Trace Info


================================================================================
2015-06-24 18:17:30                                           0s elapsed
---- TicketSimulation ----------------------------------------------------------
[                                                                          ]  0%
          waiting
: 1      / active: 0      / done:0    
---- Requests ------------------------------------------------------------------
> Global                                                   (OK=0      KO=0     )

================================================================================

18:17:30.589 [TRACE] i.g.h.a.AsyncHandlerActor -
>>>>>>>>>>>>>>>>>>>>>>>>>>
Request:
request_0
: OK
=========================
Session:
Session(TicketSimulation,7868637437871475496-0,Map(gatling.http.cookies -> CookieJar(Map())),1435141050448,0,OK,List(),<function1>)
=========================
HTTP request
:
GET
Someurl
headers
=
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
Accept-Language: zh-CN
Accept-Encoding: gzip
User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; zh-cn; MI NOTE LTE Build/KTU84P) AppleWebKit/533.1 (KHTML, like Gecko)Version/4.0 MQQBrowser/5.4 TBS/025438 Mobile Safari/533.1 MicroMessenger/6.2.0.52_r1162382.561 NetType/WIFI Language/zh_CN
Connection: keep-alive
Host: somehost



The cookie is just empty, what's wrong ?

Stéphane LANDELLE

unread,
Jun 25, 2015, 1:24:52 PM6/25/15
to gat...@googlegroups.com
Which version do you use?
What do key and value look like?

Stéphane Landelle
Lead developer


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Camilo Contreras

unread,
Oct 9, 2015, 9:57:00 AM10/9/15
to Gatling User Group
I'm using 2.0.3, and I'm having same issue:

.exec(addCookie(Cookie("stdo", f3188321-a82d-42ea-80e5-b0f57ff6e9fb")))
.exec(
http("Request 1")
.post(s"${theUrl}/api/")
)

The request doesn't have the cookie I'm adding. 

Stéphane LANDELLE

unread,
Oct 9, 2015, 9:59:55 AM10/9/15
to gat...@googlegroups.com
Quote from the group rules/advices

"Check that you're not running an old version and that upgrading doesn't fix your problem"

Stéphane Landelle
Lead developer


Camilo Contreras

unread,
Oct 9, 2015, 10:11:46 AM10/9/15
to Gatling User Group
Well, I didn't tell you the whole history. I'm not using Gatling directly, I'm using the SBT Gatling plugin, and I'm not able to use the latest version of Gatling/plugin, given that all of the projects we are working on, use Scala 2.10, and we found issues when trying to use the latest version of the plugin with Scala 2.10 (https://groups.google.com/forum/#!topic/gatling/pSrJTs-ohQU). 

So, we have to stick to Gatling 2.0.3, which has been working great so far, until this point, where I don't know why the cookie is not set. 

Thanks in advance for your help. 

Stéphane LANDELLE

unread,
Oct 9, 2015, 10:18:50 AM10/9/15
to gat...@googlegroups.com
Except if you have strong dependencies to some internal libraries, you'd better move the Gatling stuff to a dedicated project/module where classpaths don't clash. I'm 100% sure the issue you're facing is fixed in 2.1.

Otherwise, sadly, as an open source project, we can't afford maintaining many concurrent versions.

Stéphane Landelle
Lead developer


Camilo Contreras

unread,
Oct 9, 2015, 2:04:33 PM10/9/15
to Gatling User Group
Moving our simulations into a dedicated project contradicts the main reason why we are using the plugin: we want to be able of manage and do version control of our perforamnce test assets in conjunction with the code base; Anyway, I understand what you're saying about the open source project. 

Thanks for your help, and for answering so fast. 

Cheers. 

Stéphane LANDELLE

unread,
Oct 9, 2015, 3:10:45 PM10/9/15
to gat...@googlegroups.com
You could perfectly have a submodule in your project that uses a different Scala version.

Stéphane Landelle
Lead developer


Guillaume Lasnier

unread,
Dec 2, 2015, 5:19:45 AM12/2/15
to Gatling User Group
I had the same issue which I managed to fix by specifying a maxAge on the the cookie :
val scn = scenario("TicketSimulation")

   
.exec(addCookie(Cookie(key, value).withMaxAge(Int.MaxValue)))
    .exec(http("ticket_get").get("some url"))

Guillaume Lasnier

unread,
Dec 2, 2015, 5:26:14 AM12/2/15
to Gatling User Group
I also had to specify baseUrl on the http protocol. Should work if you specify the domain on cookie as well.
Reply all
Reply to author
Forward
0 new messages