In jmeter context, is there any way to clear cookies after each http request within the same thread group?
1
votes
1 Answers
4
votes
Why in that case you need HTTP Cookie Manager at all? Just remove it and you'll get expected behaviour.
Just in case you have some form of weird negative test scenario:
- Add a Beanshell Listener or Beanshell Assertion at the same level with all HTTP Request samplers
Put the following code into "Script" area
import org.apache.jmeter.protocol.http.control.CookieManager; CookieManager manager = ctx.getCurrentSampler().getProperty("HTTPSampler.cookie_manager").getObjectValue(); manager.clear();
See the following reference material:
- JMeterContext class JavaDoc (referenced as
ctx
in the above script) - CookieManager class JavaDoc
- How to Use BeanShell: JMeter's Favorite Built-in Component