Alexandr
Alexandr

Reputation: 9525

Using cookies in jMeter Tests

jMeter is used for load testing. The sequence of action is following:

  1. request login page.
  2. request some specific page.

The View Results Tree is used to see requests/responses details.

In the request login userName and password are sent via POST HTTP request. In the response I can see the following:

Thread Name: User Threads Configuration 1-1
Sample Start: 2014-08-27 18:38:39 NOVT
Load time: 23
Latency: 8
Size in bytes: 24979
Headers size in bytes: 425
Body size in bytes: 24554
Sample Count: 1
Error Count: 0
Response code: 200
Response message: OK

Response headers:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=ET5cR1buk+HURt6IqumsMaEb; Path=/
P3P: CP="CAO PSA OUR"
X-XSS-Protection: 0
X-Powered-By: JSP/2.2
Expires: Sat, 6 May 1995 12:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Pragma: no-cache
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 27 Aug 2014 11:38:39 GMT

First of all I cannot see all cookies that should be received. When I login manually via login page in browser I can see more than 7 cookies in the response. What am I doing wrong?

And next: How to apply jMeter all cookies that have been receive during login request, for sending them in the next request? Obviously at first, I have to see cookies in the loging response.

Upvotes: 0

Views: 478

Answers (1)

UBIK LOAD PACK
UBIK LOAD PACK

Reputation: 34566

For second part, just add a HTTP Cookie Manager.

For first part, probably you need to make some parameter or header in the login request dynamic which you didn't so login may be failing.

Show the cookie you receive in browser vs cookies in jmeter.

Upvotes: 0

Related Questions