'How do I set cookie values dynamically in "HTTP CookiesManager" i.e. ai_user & ai_session for incoming user in ecommerce site in JMeter?

I want to set user defined cookies value i.e. ai_user & ai_session dynamically for each user in "HTTP CookiesManager" in JMeter, as it happens in browser ecommerce website. It's hard code for now but I want it's value dynamic & unique for each incoming user.



Solution 1:[1]

It's sufficient to add a HTTP Cookie Manager to your test plan and it will automatically handle incoming cookies

If it doesn't - most probably something is wrong with the application you're testing, i.e. it responds with invalid or expired cookies. If this is the case you can consider changing the "Implementation" to something less-restrictive

enter image description here

and/or add the next line to user.properties file:

CookieManager.check.cookies=false

More information: HTTP Cookie Manager Advanced Usage - A Guide

Also it's always possible to handle the cookies manually by extracting them from Set-Cookie response header using Regular Expression Extractor and add them to resulting JMeter Variables to HTTP Cookie Manager (or HTTP Header Manager)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitri T