-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

JMeter Cookbook
By :

Most websites have a means of authenticating users, thereby enabling them to gain access to protected data or content that only pertains to them. Also, it is very common for websites to give users different roles based on what the user will be doing. For instance, a user called Joe
could be given admin privileges while Susan
is only given user privileges. Whatever the case, JMeter has a way to maintain HTTP user sessions for your test scripts.
In this recipe, we will detail how to accomplish this with JMeter. Perform the following steps:
add_cookie_manager.jmx
test script. GET http://evening-citadel-2263.herokuapp.com/
[no cookies]
Request Headers:
Connection: keep-alive
Host: evening-citadel-2263.herokuapp.com
User-Agent: Apache-HttpClient/4.2.6 (java 1.5)
GET http://evening-citadel-2263.herokuapp.com/ Cookie Data: connect.sid=s%3AWN5ITZxWEKyzmmAB5sct7PjA.6UAJ36%2F9%2BWFQPjdzA%2B7%2B1NL4%2Bf0HzC %2BOQI%2Bol0V0eJ0 Request Headers: Connection: keep-alive Host: evening-citadel-2263.herokuapp.com User-Agent: Apache-HttpClient/4.2.6 (java 1.5)
The HTTP Cookie Manager stores and sends cookies like a web browser does. The cookie of any request that contains one is automatically extracted and stored by the component to be used for all future requests from that particular thread. Each JMeter thread gets its own session just like in a regular web browser to prevent users' sessions from overlapping with each other.
Apart from the automatically extracted cookies by the HTTP Cookie Manager component, JMeter provides a way to add user-defined cookie values to a test plan. Unlike their automatically extracted counter parts, once defined, all threads executing in the test plan will share these values.
Change the font size
Change margin width
Change background colour