I am trying to use Gatling to test my API, but I have a problem. Now I am testing login / logout. Upon entering the system, the user received a token, which is used to exit the system.
When I use the recorder, it saves the fix token, and of course it does not work when I run the test. But I can not find in a document or Google how I can get a dynamic token.
Somebody knows?
Thank!
EDIT:
after writing here what i got
val headers_13 = Map(
"Accept" -> """*/*""",
"Origin" -> """http://site.com""",
"token" -> """token"""
)
val scn = scenario("Scenario Name")
.exec(http("request_1")
.post("http://site.com/login")
.headers(headers_1)
.param("""player[email]""", """email@address.com""")
.param("""player[password]""", """password""")
)
.pause(757 milliseconds)
...
.exec(http("request_13")
.get("http://site.com/logout")
.headers(headers_13)
)
.pause(202 milliseconds)
I am trying to put two snippets of code after .post (" http://site.com/login ") and .get (" http://site.com/logout "), but this does not work
Simon