Hi all,
I am aware of Jmeter tool. I used to get ticket using correlation concept.
Am new to Gatling. I recorded a scenario of Https Application. I got a scala file saved . It consists of a launch URL, login and logout actions. When we launch URL, it generates a ticket. I need to use this ticket for a login transaction. How can i use checks concept to extract Ticket.
Thanks & Regards
Narasimha
It would probably be good for you to share two snippets from your scenario:
- The request from your scenario that generates the ticket and what you expect the response to be
- A request from your scenario that shows how you use the generated ticket
Hi Spencer Chastain,
This is the Gatling recorder script.
//LaunchURL
val httpProtocol = http
.baseURL(“https://mywebsite/instance”)
.acceptHeader("/")
.acceptEncodingHeader(“gzip, deflate”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.connection(“keep-alive”)
.userAgentHeader(“Mozilla/5.0 (Windows NT 5.1; rv:26.0) Gecko/20100101 Firefox/26.0”)
//Login
.exec(http(“request_6”)
.post("""/cas/login;jsessionid=cN7KK9FvXzsqWjmLxL2M5xjk.undefined?service=https://mywebsite/instance/index.jsp""")
.headers(headers_6)
.param(""“username”"", “”“abc”"")
.param(""“password”"", “”“abcpwd”"")
.param(""“lt”"", “”“LT-828-wppjtrEoGU6gj9UVFt3soVqQ3mLMwe”"")
.param(""“execution”"", “”“e1s1"”")
.param("""_eventId""", “”“submit”"")
.param(""“submit”"", “”“LOGIN”""))
.pause(10)
If We see these three lines
.param(""“username”"", “”“abc”"")
.param(""“password”"", “”“abcpwd”"")
.param(""“lt”"", “”“LT-828-wppjtrEoGU6gj9UVFt3soVqQ3mLMwe”"")
we will use parametrization for username and password. these are input values we can get from a csv file while running the test. Here “lt” is the parameter for ticket. it was generated by CAS when we Launch the URL.
The following code is the portion of BaseURL response.
Username:
|
Password:
|
Warn me before logging me into other sites.
_**__
|
|
Here CAS generated ticket "LT-828-wppjtrEoGU6gj9UVFt3soVqQ3mLMwe" in BaseURL Response. Here, I need to extract ticket from the BaseURL Response and use this ticket in Login request.
Previous i extracted ticket using regular expression in Jmeter as name=“lt” value="(.*?)" from BaseURL Response.
Please help me how to extract ticket in Gatling.
Thanks & Regards
Narasimha