Monday, May 11, 2015

JMeter Setting user defined cookie

a.      Add a BeanShell PreProcessor in the HTTP Request where you need to use the cookie
import org.apache.jmeter.protocol.http.control.CookieManager;
  import org.apache.jmeter.protocol.http.control.Cookie;
  CookieManager manager = sampler.getCookieManager();
  Cookie cookie = new Cookie("CRM_Cookies","CRM_EmplId=${employeeId}[$$]CRM_CompanyID=${company}[$$]CRM_Admin=Y","reportsuiqeb.hrpassport.com","/",false,0);

  manager.add(cookie);

No comments:

Post a Comment