Scala Question

Gatling-tool Extracting cookie data

I'm currently writing a test simulation with gatling and I've hit a brick wall. One of my post requests has an odd requirement. the request is:

.post("/checkout/cart/add/product/form_key/")


This post request wont complete with appending the form key on the end of the URL, the form key is stored in a cookie called: CACHED_FRONT_FORM_KEY

I need a way to grab the value in that cookie from the gatling cookiejar and to be used in the post request as follows:

.post("/checkout/cart/add/product/form_key/${FORM_KEY}")


I have done some googling and found a similar request:

https://groups.google.com/forum/#!topic/gatling/gXosGVnUuZA

But I'm unsure of how to implement this into a simulation file, I'm currently using gatling 1.4.3. Any assistance would be most appreciated.

Answer Source

You can use a regexHeader check on the Set-Cookie reponse header in order to capture the cookie value.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download