vendredi 19 juin 2015

JMeter 2.10 Random Variable that gets data from string

I have 1st thread group that GETs some id's and writes it to the variable. This var has view like that "654564546,564564,56454,56456454,21231321,8972341,65423187". I need to pick up randomly one of the id and put it to the another variable. In jmeter 2.07 I used this 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 this 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 




Aucun commentaire:

Enregistrer un commentaire