jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavel Gouchtchine <guserl...@gmail.com>
Subject BeanShell function and String operations
Date Fri, 04 Mar 2016 19:36:52 GMT
Hi All,
I am using JMeter 2.13 with bsh-2.0b4.jar.

A call to String replaceAll, or substring methods within BeanShell function
does not work. I am getting exception.

Here is example:
in User Defined Variables I am trying to assign a variable with value
${__BeanShell(String s =  "abcd asfasd asdfas"; return  s.substring(3,4);)}
That throws the following exception:
2016/03/04 14:21:25 ERROR - jmeter.util.BeanShellInterpreter: Error
invoking bsh method: eval Parse error at line 1, column 54.  Encountered: (
2016/03/04 14:21:25 WARN  - jmeter.functions.BeanShell: Error running BSH
script org.apache.jorphan.util.JMeterException: Error invoking bsh method:
eval Parse error at line 1, column 54.  Encountered: (
 at
org.apache.jmeter.util.BeanShellInterpreter.bshInvoke(BeanShellInterpreter.java:191)
 at
org.apache.jmeter.util.BeanShellInterpreter.eval(BeanShellInterpreter.java:197)


Value assignment is working OK if I am using subsring(3):
${__BeanShell(String s =  "abcd asfasd asdfas"; return  s.substring(3);)}


The exception is thrown as well if replaceAll method is called on a string
object.

I have tried bsh-2.0b4.jar and JMeter default bsh-2.0b5.jar.

Please help.
Pavel Gouchtchine.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message