JMeter 2.10 Random Variable that gets data from string -
i have 1st thread group gets id's , writes variable. var has view "654564546,564564,56454,56456454,21231321,8972341,65423187". need pick randomly 1 of id , put variable. in jmeter 2.07 used code:
import java.util.random; string[] erroridcox = (vars.get("erroridcox")).split(","); int id1 = new random().nextint(erroridcox.length); string randerror = (erroridcox[id1]); vars.put("rnd_erroridcox", randerror);
but in jmeter 2.10 code doesn't work. jmeter log says:
jmeter.util.beanshellinterpreter: error invoking bsh method: eval sourced file: inline evaluation of: ``import java.util.random; string[] erroridcox = (vars.get("erroridcox")).split( . . . '' : typed variable declaration
your code looks good, possible failure point erroridcox
variable not being set.
add debug sampler , view results tree listener double-check erroridcox
, rnd_erroridcox
variable values.
also can put debug();
function @ beginning of script , stdout observe flow - provide sufficient information figure out cause.
see how debug apache jmeter script more debugging techniques explained.
Comments
Post a Comment