1

What exactly is the usage of HTTP Cookie manager.

How do we determine, while writing a script that the website needs a HTTP Cookie Manager.

1 Answer 1

3

What exactly is the usage of HTTP Cookie manager

HTTP Cookie Manager, stores and send the cookies just as a browser do. If your HTTP Request response contains a cookie, the Cookie Manager automatically stores that cookie and will use it for all future requests to that particular web site. Use of cookies eventually becomes necessary when you application has to maintain session, like once your logs in to an application, it maintains the session of that user so that he/she can work inside the application. If that session is not maintained (via Cookie Manager in case of JMeter), then user will logged out of the application as soon as he/she sends next request which requires Authentication.

You can take it like this, if your application have a session or uses cookies, then your script will not work without adding cookies in cookie manager, as then your script will not be able to maintain the session and the users (Threads) will be kicked-off the application as soon as they enter into it.

Each JMeter thread has its own "cookie storage area". So, if you are testing a web site that uses a cookie for storing session information, each JMeter thread will have its own session.

How do we determine, while writing a script that the website needs a HTTP Cookie Manager.

  1. One way is if you know about the application (which ideally a performance tester should know) that whether application maintains any kind of session or not. This should be part of the Performance test planning and Requirement gathering sessions conducted before starting with the Performance testing. So, you should gather this information before hand either ask the Developers, QAs working with that application.
  2. Another way is using any kind of developer tool like HTTPWatch, Fiddler, IE Developer Tool bar etc. as these tools will clearly tell you what all cookies are being used by your application and which request requires which cookie.
  3. Using the reverse methodology (this may sound little weird, but really helpful), use 'View Results in Tree' listener in your test plan, then without adding Cookie Manager (as at this point you don't know whether you require it or not) run your script. We both know that it will fail, but let it get fail. Then from the 'Sampler Result' tab of the Tree Listener you will get knowledge that whether 'Your application is using any cookies or not? If yes then what are the name of cookies being used?'. Once you get the cookies name from there, you can add the same to your cookie manager.
  4. Lastly, Thumb rule is 'If your application is having any kind of session, authentication then you will definitely need HTTP Cookie Manager in your JMeter script'.

You can also refer to the below mentioned links for more details

https://blazemeter.com/blog/using-http-cookie-manager-jmeter-not-cookie-jar

https://lincolnloop.com/blog/load-testing-jmeter-part-1-getting-started/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.