我一直在尝试使用cookies
进行相当简单的JMeter测试并运行数天并且根本没有运气。我已经用尽了所有SO线程试图解决这个问题,但还没有运气。
我的测试只是将登录用户名/密码POST到服务器,如果成功则返回SAML令牌。然后,我将SAML令牌重新提交到我的回复方网站,该网站成功响应标头中的Cookie。
但是,每个后续请求都不会传递这些cookie。
以下是我的计划布局:
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
我启用了这些设置:
CookieManager.allow_variable_cookies=true
CookieManager.save.cookies=true
CookieManager.check.cookies=false
第三个HTTP请求采样器的结果响应HTTP响应,如下所示:
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
我也意识到有些cookie是从服务器设置的两次,但这是我无法控制的。我希望这不是问题...
答案 0 :(得分:0)
在jMeter中传递cookie变量(您可以以这种方式访问您的ASP.NET_SessionId $ {COOKIE_ASP.NET_SessionId})将cookie值传递给与请求关联的HTTP标头管理器。