Skip to content
  • ZipCode Api
  • Blog
  • About RedLine13
RedLine13
RedLine13
Primary Navigation Menu
Menu
  • Start Testing
  • Demo
  • Pricing
  • JMeter
  • Partners
  • Docs
    • Documentation Home
    • AWS Set Up for load testing
    • AWS Approval for Large Tests
    • PHP, NodeJS, Python Load Tests
    • Scalability
    • Jenkins Plugin Setup
    • Premium Features
    • Knowledge Base

Understanding and Using HTTP Cookie Manager – Update on Property save.cookies

By: RedLine13

This is one of our most popular blog posts. We’ve added new information on the property save.cookies at the bottom of the post. This post answers a common JMeter question: I would like to understand and see an example to use HTTP Cookie Manager and explain the different reasons I might use it.

Cookie Characteristics

In a stateless internet, many sites and applications use cookies to retain a handle between sessions or to keep some state on the client side.  If you are planning to use JMeter to test such web applications, then you will want to use HTTP Cookie Manager. Cookie Manager automatically handles cookies (stores and send cookies) without any additional configuration just like a web browser does. In layman language, if you do not add a Cookie Manager then JMeter test will behave like a browser with disabled cookies. Following are a few significant characteristics:

  • Store Cookies: HTTP Cookie Manager automatically stores cookies and will use it for all future requests to that particular website
  • Threads and Cookies: Each JMeter thread has a separate “cookie storage area” and stores cookies specific to a thread/user. Let’s say if you are running a JMeter test for multiple threads/users then it will store cookies separately for each user (for example session cookie)
  • Properties: JMeter allows altering the default behavior/configurations of cookies manager by changing its properties value for example:
    • save.cookies=true/false (set it to true if you want to keep cookies as variables)
    • check.cookies=true/false (set it to false if you want to store cross-domain cookies and might use them later)
    • name.prefix=true/false
    • delete_null_cookies=true/false
  • Custom Defined: Cookies Manager allows you to add a cookie manually. Manually added cookies will be shared by all threads/users
  • Cookie Policy and Implementation
    • this has real consequences on how cookies are managed and sent via your web requests
    • We primarily stay with the default to simulate a browser as close as possible.

Example Plans – HTTP Cookie Manager

We built two test plans to show you the difference with and without CookieManager.  The test performs a login and looks for validation that the user is logged in.

Test Plan with CookieManager Enabled

  • https://www.redline13.com/share/testplan/23152

Please try to run and you will notice that your test case will pass. You can see this behavior in “view results tree.”

Test Plan with CookieManager Disabled

  • https://www.redline13.com/share/testplan/23155

Try again to run the same test after disabling cookies manager and compare the results of both runs.  If your cookies manager is disabled, then the user will not be logged in, and your sampler will fail due to the assertion.

View Results Tree

Manually you can compare this behavior by enabling and disabling cookies in the real browser and try to log in.

With RedLine13, you can run a JMeter Load Test with your JMX script of any mobile application, web application, or API.

HTTP cookie manager

Property save.cookies

Here is the new information on the property save.cookies=true/false option. In some circumstances you may need to store the cookie data as a variable and then use it with your next request. To enable the save.cookies option, open the JMeter.properties file and set CookieManager.save.cookies=true. By default it is false.

After enabling the save cookies property on jmeter.properties file you can use the cookie variable in your JMeter requests with ${COOKIE_Authorization} syntax. In this example we are using the cookie variable inside the Header Manager for the authorization.

In the planning phase of the load test you should determine what type of user will need to perform the test.

There are 2 options: guest or registered users.

With guest users, the test doesn’t keep any data on each iteration. So the response time is much longer.

With registered users, the test keeps data on each iteration. The response time will be much shorter.

In order to get realistic results you should determine which type of user you will use.

This is a critical phase of your load test in getting more realistic results. The options are new users or existing users.

If you would like to test your system with a new users you should check the “Clear cookies each iteration?“ option.

However if you would like to perform your test with existing users, leave this option unchecked.

You can try your own test, whether it is simple or uses cookies, on RedLine13 for free.

2019-11-06
Previous Post: Integrating Automated Testing with Jenkins – Team Support Included
Next Post: Load Test with JMeter 5.2 – RedLine13 Supports JMeter 5.2, JMeter Nightly and More

Recent Posts

  • Order of Elements in JMeter
  • The JMeter Synthesis Report
  • Using the JMeter Plugins Manager
  • JMeter Rotating JTL Listener
  • Using Test Fragments in JMeter Tests

Related

  • Order of Elements in JMeter
  • The JMeter Synthesis Report
  • Using the JMeter Plugins Manager
  • JMeter Rotating JTL Listener
  • Using Test Fragments in JMeter Tests
  • Step-by-Step Guide to Testing with JMeter
  • Functional Testing vs Performance Testing
  • A Gentle Introduction to Load Testing
  • Using the JMeter Counter Element
  • Getting a “Grounded” Test to Launch

© RedLine13, LLC | Privacy Policy | Contract
Contact Us: info@redline13.com

Designed using Responsive Brix. Powered by WordPress.