I have tried few regular expressions for Gatling that work in JMeter to capture dynamic values.
Here’s is response data :
userSession value=113711.964682058fitQAfQpViDDDDDDDfAQtpDffV>
I wanna capture value tha is in bold above.
My trials :
1.) .check(regex(""“userSession value=(.?)>""").saveAs(“account_id”))
2.) .check(regex("""userSession value=([0-9]{6}.[0-9a-zA-Z])>”"").saveAs(“account_id”))
3.) .check(regex(""“userSession value=(.*)>”"").saveAs(“account_id”))
Its throwing value(…).exists didn’t match : found nothing
After sometime, the place where i replaced value with variable name(here,account_id) , throwing account_id is not defined.
Please do needful
Here is my code :
val scn = scenario(“Scenario Name”)//place where i captured
.exec(
http(“request_1”)
.get("""/WebTours/index.htm""")
.check(regex(""“userSession value=(.*)>”"").saveAs(“account_id”))
)
…
.exec(http(“request_11”)//place where i replaced
.post("""/cgi-bin/login.pl""")
.headers(headers_11)
.param(""“userSession”"", “”"${account_id}""")
.param(""“username”"", “”“user1"”")
.param(""“password”"", “”“user1"”")
.param(""“login.x”"", “”“67"”")
Thanks
Raju