How to modify / add to Cookie in JMeter?

后端 未结 3 1805
深忆病人
深忆病人 2021-01-14 00:47

I\'m very new to JMeter and need your help on how to modify a cookie.

Here is the scenario: I\'m testing an assessment/test taking website that offers multiple answe

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-14 01:31

    Use a Beanshell pre-processor or better a Jsr223 Pre-Processor with groovy and use code mentionned here:

    • http://javaworks.wordpress.com/2011/08/05/setting-cookie-in-jmeter/

    Code:

    import org.apache.jmeter.protocol.http.control.CookieManager;  
    import org.apache.jmeter.protocol.http.control.Cookie;
    CookieManager manager = sampler.getCookieManager();
    Cookie cookie = new Cookie("","","","/",false,0);
    manager.add(cookie);
    

提交回复
热议问题