Session Usage in gatling

65 views
Skip to first unread message

Mohit Garg

unread,
Mar 20, 2015, 12:04:38 PM3/20/15
to gat...@googlegroups.com
How to use session in Gatling?

Lets say my application is returning an token in a response so how to save that token from url.

I know that we can use session but I have no idea how to do that.

Please help in writing the .scala file for above scenario?

Gregory Melekh

unread,
Mar 22, 2015, 4:37:29 AM3/22/15
to gat...@googlegroups.com
 
You can do it like this:

http("doLogin")
 .post("/sign_in")
 .formParam("""user[login]""", """gatling""")
 .formParam("""user[password]""", """123456""")
.formParam(""".....""","""....""")
.

 .check(regex("""<meta content="(.*?)" name="csrf-token""").saveAs("token"))

Mohit Garg

unread,
Mar 24, 2015, 9:24:32 AM3/24/15
to gat...@googlegroups.com
Thanks Gregory ,

I am trying to do so. But I am getting some error. Can you verify me again with correct syntax to extract a parameter from response url. Now I need to fetch two parameters and how to print them in my simulation script.

Please help me?

Reply all
Reply to author
Forward
0 new messages