This is the Gatling recorder script.
val httpProtocol = http
// LaunchURL
.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.
<table width="100%">
<tr>
<td>
<label for="username" class="fl-label"><span class="accesskey">U</span>sername:</label>
<input id="username" name="username" class="required" tabindex="1" accesskey="u" type="text" value="" size="25" autocomplete="false"/>
</td>
</tr>
<tr>
<td>
<label for="password" class="fl-label"><span class="accesskey">P</span>assword:</label>
<input id="password" name="password" class="required" tabindex="2" accesskey="p" type="password" value="" size="25" autocomplete="off"/>
</td>
</tr>
<tr>
<td>
<input id="warn" name="warn" value="true" tabindex="3" accesskey="w" type="checkbox" />
<label for="warn"><span class="accesskey">W</span>arn me before logging me into other sites.</label>
<input type="hidden" name="lt" value="LT-828-wppjtrEoGU6gj9UVFt3soVqQ3mLMwe" />
<input type="hidden" name="execution" value="e1s1" />
<input type="hidden" name="_eventId" value="submit" />
</td>
</tr>
<tr>
<td>
<input class="btn-submit" name="submit" accesskey="l" value="LOGIN" tabindex="4" type="submit" />
<input class="btn-reset" name="reset" accesskey="c" value="CLEAR" tabindex="4" type="reset" />
</td>
</tr>
</table>
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.
and can u please tell me how to correlate View states also.
Thanks & Regards
Narasimha