I'm trying to convert a String to a Long integer, then do some calculations, then convert back to String. The entire code in the beanshell postprocessor is here (depositamount and imagecount are variables already known in JMeter):
Long ttl=Long.valueOf(vars.get("depositamount"));
Long med=Long.valueOf(vars.get("depositamount"));
Long intermediate=med/vars.get("imagecount");
String depamt=intermediate.toString();
vars.put("depositamount",depamt);
Double tlnlast=ttl-depamt * (vars.get("imagecount")-1);
vars.put("lastamt",tlnlast.toString());
vars.put("loopcounter","1");
However, when I run this, I get an error: ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``Long ttl=Long.valueOf(vars.get("depositamount")); Long med=Long.valueOf(vars.get . . . '' : Typed variable declaration : Method Invocation Long.valueOf
. I've tried to use Long.parseLong
in place of the valueOf, but the same error gets thrown, with the "parseLong" taking the place of "valueOf".
I can't figure out what I'm doing wrong. Thanks!