7
votes

I have got several thread groups. I want to use variable from the first group. In second group this var should be used in BeanShell. So: in first thread group I created BeanShell Assertion with this code:

 ${__setProperty(erroriden, ${erroriden1})};

In second thread group I have BeanShell pre-processor. If has line like this:

String[] erroriden = (vars.get("erroriden")).split(",");

I tried some variations like this:

String[] erroriden = (vars.get("__property(erroriden)")).split(",");
String[] erroriden = (vars.get("${__property(erroriden)}")).split(",");

but it doesn't work. Please help to use ${__property(erroriden)} in BeanShell pre-processor.

1
Do you get any errors? I what way "doesn't it work"? - tvgemert
Hm, seems that structure String[] erroriden = (vars.get("${__property(erroriden)}")).split(","); works ok. Log says: 2015/06/23 16:33:25 WARN - jmeter.modifiers.BeanShellPreProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import java.util.Random; String[] erroriden = (vars.get("6618291,2072106868,601 . . . '' : Typed variable declaration - Ololowa QA

1 Answers

10
votes

In the first Thread Group:

props.put("erroriden", vars.get("erroriden1"));

In the second Thread Group:

String[] erroriden = props.get("erroriden").split(",");