使用 jmeter(版本5.4.1)工具进行 http请求返回后结果处理时, beanshell中的java代码报错"BeanShellInterpreter: Error invoking bsh method: eval In file: inline evaluation of...",详情如下图:
以下为修改前beanshell 脚本部分代码:
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中
}
至此,问题解决。
最后
以上就是生动夕阳最近收集整理的关于BeanShellInterpreter: Error invoking bsh method: eval In file: inline evaluation of 问题解决的全部内容,更多相关BeanShellInterpreter:内容请搜索靠谱客的其他文章。
发表评论 取消回复