1
votes

In jmeter context, is there any way to clear cookies after each http request within the same thread group?

1
Like you say, it's for each iteration, not for each http request sampler within the loop.Aladdin

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:

  1. Add a Beanshell Listener or Beanshell Assertion at the same level with all HTTP Request samplers
  2. 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: