1
votes

I have been trying to get a rather simple JMeter test up and running with cookies for days and having no luck at all. I have exhausted almost all SO threads with attempts to fix this, but no luck yet.

My test is simply to POST login username/password to a server, which returns a SAML token if successful. Then I resubmit that SAML token to my replying party site, which successfully responds with cookies in the headers.

However, every subsequent request does NOT pass along these cookies.

Here is the layout of my plan:

Thread Group
    HTTP Request Default
    HTTP Cookie Manager
    HTTP Request - GET load login page
    HTTP Request - POST user/pass to remote server and store SAML token
    HTTP Request - POST Submit SAML token to Relying Party site (successfully returns cookies in response)
    HTTP Request - GET View protected page (always send [no cookies])
    Debug Sampler
    View Results Tree
    Aggregate Report

I Have enabled these settings:

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

The result of the 3rd HTTP Request Sampler responds with a HTTP Response like this:

Thread Name: Visitors 1-1
Sample Start: 2015-09-29 11:53:49 AEST
Load time: 1949
Connect Time: 400
Latency: 1369
Size in bytes: 83261
Headers size in bytes: 2013
Body size in bytes: 81248
Sample Count: 1
Error Count: 0
Response code: 200
Response message: OK

Response headers:
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Content-Type: text/html; charset=utf-8
Expires: -1
Pragma: no-cache
Content-Length: 81248
Date: Tue, 29 Sep 2015 01:53:52 GMT
Connection: keep-alive
Set-Cookie: sitecore_device=; path=/
Set-Cookie: .ASPXAUTH=CC27DB52E62EA5412220CB33ECD9BB84F4A65B76C5A46F8A5A2271AC862C8ED4C71F06258060F30EEB162EF43863B5EDBCDAE0D07002AA71D64F5A473D6FF197E2598F1ACAACB6E36D64D5B9E3B59C102851FF9B22844079BCA09326D491FE5F763E5C7A03FE89AA000600E452B5EAAA64AB83ED5D870B18F86DD213A524FB2F2DF76FECDCB302DEB51BBF39F9FAE6308111E5E084009F1DD8A82E700D8C8DD04E7015DAFFEB5F7373210019F72DF323C3CF2D02; path=/; HttpOnly
Set-Cookie: ASP.NET_SessionId=1yguqfbt5eyrvgo1agawui0z; path=/; HttpOnly
Set-Cookie: sitecore_device=; path=/
Set-Cookie: .ASPXAUTH=CC27DB52E62EA5412220CB33ECD9BB84F4A65B76C5A46F8A5A2271AC862C8ED4C71F06258060F30EEB162EF43863B5EDBCDAE0D07002AA71D64F5A473D6FF197E2598F1ACAACB6E36D64D5B9E3B59C102851FF9B22844079BCA09326D491FE5F763E5C7A03FE89AA000600E452B5EAAA64AB83ED5D870B18F86DD213A524FB2F2DF76FECDCB302DEB51BBF39F9FAE6308111E5E084009F1DD8A82E700D8C8DD04E7015DAFFEB5F7373210019F72DF323C3CF2D02; path=/; HttpOnly
Set-Cookie: ASP.NET_SessionId=1yguqfbt5eyrvgo1agawui0z; path=/; HttpOnly
Set-Cookie: rvconf=0; path=/; HttpOnly
Set-Cookie: rvre=14432509917526119; path=/; HttpOnly


HTTPSampleResult fields:
ContentType: text/html; charset=utf-8
DataEncoding: utf-8

I also realise that some cookies are being set twice from the server, but this is out of my control. I hope that this is not the issue...

1
What kind of error are you getting, and what have you tried, from what it sounds like you need to use the cookie variable in jMeter to pass the value to the HTTP Header Manager associated with the request.JusMe

1 Answers

0
votes

Pass the cookie variable in jMeter (you can access your ASP.NET_SessionId in this manner ${COOKIE_ASP.NET_SessionId}) to pass the cookie values to the HTTP Header Manager associated with the request.

JMeter Cookie Manager