I need to pass a value from one Thread Group to another Thread Group, in particular I have to pass a value from BeanShell sampler to Counter. This is my BeanShell code:
Counter.Calendar c =
Calendar.getInstance();
long now = c.getTimeInMillis();
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
long passed = (now - c.getTimeInMillis())/1000;
vars.putObject("startTime",passed);
${__setProperty("start",vars.getObject("startTime"))};
and I have to use passed value into Counter as Start value.I set ${__P("start")} or ${__property("start")} but neither of the two worked. I tried to use this method also into BeanShell Sample of another thread group, but i had error. In the same Beanshell it works and sets variable. How can I use properties or other way to pass this value? thanks
PS: If I ${__setProperty("start",123)}; it works (other thread receives 123), else it doesn't see the variable. Also if I put beanshell sapler in the same thread have a problem: given that Counter is processed before sampler, the counter value isn't updated.