Hey I'm doing some beanshell scripting for API testing in jmeter. I've written quite a few jmeter scripts with beanshell and it works fine when using Integer.parseInt()
method invocation, but I have a value with decimal places where my SQL returns a value of 20.00000 and my Json path extractor gets 20.0 so my test fails when comparing it. Because of this problem I decided to compare this values as double variables instead of Strings but I'm getting the error bellow when using Double.parseDouble on BeanShell.
2016/08/17 12:48:45 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of:
print("Width Assertion..."); int Total_Printers_SQL = Integer.parseInt(vars.get . . . ''
: Typed variable declaration : Method Invocation Double.parseDouble2016/08/17 12:48:45 WARN - jmeter.assertions.BeanShellAssertion: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of:
print("Width Assertion..."); int Total_Printers_SQL = Integer.parseInt(vars.get . . . ''
: Typed variable declaration : Method Invocation Double.parseDouble
Even with the errors displayed the value of the double variable is printed on Jmeter prompt as you can see below.
If anyone's a beanshell expert and could help me identify the error, that'd be awesome. Thanks!
Double.parseDouble(vars.get("Printer_Width_SQL_" + i).toString())
... It might need "to be told" it's a string. – Iske