BeanShellInterpreter: Error invoking bsh method: eval In file: inline evaluation of 问题解决

使用 jmeter(版本5.4.1)工具进行 http请求返回后结果处理时, beanshell中的java代码报错"BeanShellInterpreter: Error invoking bsh method: eval In file: inline evaluation of...",详情如下图:

BeanShellInterpreter: Error invoking bsh method: eval In file: inline evaluation of 问题解决_第1张图片

以下为修改前beanshell 脚本部分代码:

BeanShellInterpreter: Error invoking bsh method: eval In file: inline evaluation of 问题解决_第2张图片

 hmGatewayAvg.forEach((key, v) -> {
      float percent = (Float.parseFloat(String.valueOf(v))/finalSumValue);//用每个状态的值除以所有状态累加值,获得状态占比率
      hmGatewaySatus.put(key,percent);//把单个状态名称,单个状态Percent值放入hashmap中
   });

网上查了下,jmeter中的beanshell脚本是不支持java 泛型的。

修改后beanshell代码:

for(Map.Entry entry : hmGatewayAvg.entrySet()){
       float v = entry.getValue();
       String key = entry.getKey();
       float percent = v/finalSumValue;//用每个状态的值除以所有状态累加值,获得状态占比率
       hmGatewaySatus.put(key,percent);//把单个状态名称,单个状态Percent值放入hashmap中
   } 

至此,问题解决。

你可能感兴趣的:(Jmeter,java,开发语言)