首页 > 解决方案 > Pass JMeter property value generated by JSR233 sampler to new request

问题描述

JSR233 sampler with Beanshell been used to convert xml file to encoded string and the value is getting printed in Jmeter console. Able to extract the value within the same sampler using JMeter properties however unable to use the same variable to new request, it goes as null/void.

Test Plan is as below:

  1. .jar file is configured under TestPlan>classpath (Browsed the jar file) which has all methods defined to encode

  2. Added Thread Group>JSR233 sampler

  3. The variable value "a" and property value "storeid" is getting printed on JMeter console, also JMeter logs successfully as "storeid value is : abcdefxcfdfd".

  4. When trying to use this 'storeid' or 'a' value to next http request (ex: path: ${__property(storeid)}), it goes as null or tried with ${a}.

  5. Also tried with vars.get and vars.put, in this case value goes as void.

How to get this variable value passed to the next request?

标签: jmeterjsr223

解决方案


If you want to set property use props

props.put("storeid", a);

Don't use ${ syntax inside JSR223 script


推荐阅读