First time poster, long time reader - For one of my Performance tests, a cookie is not being passed for one of the requests. I have been trying many of the suggestions that I found here and other places online and I still cant seem to manually add a cookie to any request.
So what I am trying to do now is just follow the sample from Blazemeter and even with my basic setup, I still can't get the cookie added. I have to be missing something easy and I am running out of hair to pull out.
(I can't post pics yet, so image link is below)
Jmeter version - 5.0 r1840935
User.Properties Updated -
CookieManager.check.cookies=false
CookieManager.save.cookies=true
I have the HTTP Cookie Manager at the ThreadGroup Level. The cookie policy is set to standard, but I also tried to use Default with no difference. The HTTP Request has following settings: serverName: blazedemo.com, Method:GET, Path:password/reset
In the JSR223 Preprocessor (Groovy 2.4.15 / Groovy Scripting 2.0) under the HTTP request, my code looks like the following (with some debug statements)
import org.apache.jmeter.protocol.http.control.CookieManager;
import org.apache.jmeter.protocol.http.control.Cookie;
//Get cookie manager
CookieManager cm = ctx.getCurrentSampler().getCookieManager()
Cookie cookie = new Cookie("sampleCookie", "sample", "opencart.abstracta.us", "/Mytest/done", false, 1557578515)
cm.add(cookie)
Cookie c=cm.get(0)
log.info("*********Cookie #3:" + c.getName() + "cookie value: " + c.getValue())
log.info("******************** Cookies count: " + cm.getCookieCount())
The Jmeter debug log shows the following so it appears that the cookie is successfully added to the store and I think it should work.
2020-01-22 19:10:35,936 DEBUG o.a.j.p.h.c.CookieManager: **Add cookie to store** opencart.abstracta.us TRUE /Mytest/done FALSE 1557578515 sampleCookie sample
2020-01-22 19:10:35,936 INFO o.a.j.m.JSR223PreProcessor: *********Cookie #3:sampleCookiecookie value: sample
2020-01-22 19:10:35,936 INFO o.a.j.m.JSR223PreProcessor: ******************** Cookies count: 1
However, the log also shows that there were no cookies found for the request -
2020-01-22 19:10:35,938 DEBUG o.a.j.p.h.c.HC4CookieHandler: Found 0 cookies for http://blazedemo.com/password/reset
When looking at the Request Body, I see the following:
GET http://blazedemo.com/password/reset
GET data:
[no cookies]
I don't see a syntax error, but do I have something setup incorrectly? If I add a cookie to the Cookie Manager in the 'User-Definied Cookies' that cookie is indeed passed along to the request.
