I have a question where I saw lots of various questsions and answers about this but nothing worked for me so far.
Please read it to the end to see it's not a duplicated post.
I'm using 2 thread groups which are using cookies. Since cookies are not being shared across thread groups, I used the method to "export" them into properties and "import" them back in the 2ns thread group with the coookie class of the CookieManager. I placed the same http request on the 1st and 2nd thread groups. Obviously it works on the first, but on the 2nd, I see it uses [no cookies].
The test structure is as follows:
HTTP Cookie Manager
Thread A - 1 thread, 1 loop
- Login page
- Beanshell PostProcessor
props.put("ASPXAUTH_Cookie","${COOKIE_.ASPXAUTH}");
props.put("ASP.NET_SessionId_Cookie","${COOKIE_ASP.NET_SessionId}");
- Page X to hit - success
Thread B - 6 thread, 1 loop
- Login page
- Beanshell Prerocessor
import org.apache.jmeter.protocol.http.control.CookieManager;
import org.apache.jmeter.protocol.http.control.Cookie;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy;
HTTPSamplerProxy sampler = ctx.getCurrentSampler();
CookieManager manager = sampler.getCookieManager();
Cookie cookie1 = new Cookie(".ASPXAUTH",props.get("ASPXAUTH_Cookie"),"","/",false,0);
manager.add(cookie1);
Cookie cookie2 = new Cookie("ASP.NET_SessionId",props.get("ASP.NET_SessionId_Cookie"),"","/",false,0);
manager.add(cookie2);
- Same Page X to hit - failure
First results for page X:
GET http://Mysite/pages/MyView.aspx?subRoute=views&pageid=7168&routeName=dashboards
Cookie Data:
.ASPXAUTH=9CB09DD7A906ED67027E9B1ED71C707A498B8234C737169AA3EF1164890A217D9CCD1F1B32736338A7DFBF3DE0A07AD45F170A0F11FE49C827581C584577372D2D3C7D4F52DE1B73D3DE9A1263150B85F302DD01B9CF93AF380F5C63F618634CEEB5C3CFD95F1081EC28F5A556B21EAA; ASP.NET_SessionId=rg4dxqm1xai4wovvfvyezggo
Request Headers:
Connection: keep-alive
X-DevTools-Emulate-Network-Conditions-Client-Id: 08a74297-b666-496a-a1cb-620054bc5db5
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Referer: http://Mysite/pages/ui/
Accept-Encoding: gzip, deflate, sdch
Accept-Language: he-IL,he;q=0.8,en-US;q=0.6,en;q=0.4,fr;q=0.2
Host: load-rec-8
Second results for page X (which is on the 2nd thread group):
GET http://Mysite/pages/MyView.aspx?subRoute=views&pageid=7168&routeName=dashboards
[no cookies]
Request Headers:
Connection: keep-alive
X-DevTools-Emulate-Network-Conditions-Client-Id: 08a74297-b666-496a-a1cb-620054bc5db5
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Referer: http://Mysite/pages/
Accept-Encoding: gzip, deflate, sdch
Accept-Language: he-IL,he;q=0.8,en-US;q=0.6,en;q=0.4,fr;q=0.2
Host: load-rec-8
Please don't answer with "don't use different thread groups" since I have to use only 1 login (1st thread group) while the 2nd thread group should run the same request for 6 users in parallel at the same time.
Whatever tests I did with lots of other posts about this subject didn't work.
Any idea please?