Monday, May 11, 2015

JMeter Using different forms of date, by means of user defined variables

Add a user defined variable


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);

JMeter Passing variables between thread group

a.      Add a “BeanShell Assertion” in Origin thread group
Inside the script Set as property
${__setProperty(preGoto,${Goto})};
${__setProperty(preSunQ,${SunQ})};
b.      Use it in the target thread group referencing the property names
${__property(preGoto)}

${__property(preSunQ)}