概述
使用 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: Error invoking bsh method: eval In file: inline evaluation of 问题解决所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复