Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jmeter cannot handle cookies for https

Tags:

jmeter

Being a beginner in Jmeter, met with necessity to run a simple flow:

  • To log in web-app using webdriver sampler
  • To get & store cookies
  • To make GET/POST requests within the web-app (e.g. navigate to any inner page)

Test runs succeed for http://, but failed on HTTP-request step with 404 for https:// (two different sites)

What has been done to resolve:

1. Cookie Manager was added to Thread Group, placed prior Samplers

2. jmeter.properties changed to:

CookieManager.allow_variable_cookies=true
CookieManager.save.cookies=true
CookieManager.check.cookies=false

Thus, after changing save cookies to true, I expected to see all cookies saved in Debug Sampler > JmeterVariables, but I don't (either for http:// or for https://)

3. Regexp extractor (placed above HTTP sampler) used as:

Reference Name: COOKIE_EXT  
Regular expression: SSESSee2ec8d6b6eedd096cb782a386b4e5c3=(.*)
Template: $1$  
Match No.: 1  
Use empty default value

Put in GET request as:

name: cookie_ext  
value: ${COOKIE_EXT} 

As a result:

Response in Debug Sampler: COOKIE_EXT=  
Request data: GET ?cookie_ext=  
[no cookies]

4. Tried to find any additional Jmeter settings for https (e.g. TSL/SSL protocols). Seems there are no any required except specifying 'https' in HTTP sampler template. Played with Implementaion & Cookie Policy in HTTP Cookie Manager, but without effect.

What could be the reason?

(Jmeter 3.0, Google Chrome 51.0, Drupal 7.43)

like image 630
Berenigo Avatar asked Jul 31 '16 10:07

Berenigo


People also ask

What is the use of HTTP Cookie Manager in JMeter?

The cookie manager stores and sends cookies just like a web browser. If you have an HTTP Request and the response contains a cookie, the Cookie Manager automatically stores that cookie and will use it for all future requests to that particular web site. Each JMeter thread has its own "cookie storage area".


1 Answers

I haven't seen any problems with handling cookies and HTTPS protocol so maybe you have misconfigured something.

HTTPS and Cookies

Remember a couple of things:

  • Any properties changes should be done in user.properties file
  • You need to restart JMeter to pick the properties up
  • Given you have CookieManager.save.cookies=true you are storing cookies into JMeter Variables already, there is no need to use regular expressions. Moreover, in case your regular expression is wrong (it seems very weird to me) you may overwrite "good" cookie from the HTTP Cookie Manager with "bad" value from the Regular Expression Extractor.

See Using the HTTP Cookie Manager in JMeter guide for more information on working with cookies in JMeter

like image 84
Dmitri T Avatar answered Oct 13 '22 12:10

Dmitri T