2
votes

I'm building a test in Jmeter and have hit a seemingly trivial problem, but I cannot find a way to overcome it.

I need to start a new session each time the test runs (I'm building in the GUI). I thought that setting the HTTP cookie manager in the Thread Group with the 'Clear cookies on each iteration' setting checked would clear the cookies on each new run of the test.

It doesn't seem to work however - when running a test for the second time the user session initiated in the previous run is still there.

In fact I am now getting a 494 server error (Cookie too large) because the cookies are accruing in size with each run of the test.

Any ideas on how to clear the cookies with each new run of the test?

2
how did you add cookies ?UBIK LOAD PACK
they're being added by the application (Magento)Chris Marshall
can you show in vuew results tree the cookie content ?UBIK LOAD PACK
hey @UBIKLOADPACK - thanks for this - it was related the environment I was working on and I sorted itChris Marshall
no pb, in this case I would suggest your delete your question :) ThanksUBIK LOAD PACK

2 Answers

1
votes

I doubt this is a JMeter problem, most likely you're receiving an incorrect cookie via Set-Cookie header from the system under test.

You can troubleshoot this issue by enabling extra logging for JMeter's HTTP Cookie manager, this can be done by adding the next line to log4j2.xml file (lives in "bin" folder of your JMeter installation)

 <Logger name="org.apache.jmeter.protocol.http.control.CookieManager" level="debug" />

JMeter restart will be required to pick up the changes


Also be aware that you can manually remove all stored cookies in an arbitrary place of your script

  1. Add JSR223 PreProcessor as a child of the HTTP Request sampler
  2. Put the following code into "Script" area:

    sampler.getCookieManager().clear() 
    
1
votes

As per your comment, issue was related to environment and not JMeter.

Most probably Cookies we stacking up due to some infinite redirection or similar environment problem.

If you face any issue with Cookie Manager, refer to reference documentation.