当我在jmeter中使用带有脚本的Beanshell Sampler时,我收到错误

时间:2015-02-12 12:16:59

标签: javascript

当我使用带有jmeter脚本的Beanshell Sampler时出现错误:

错误 - jmeter.util.BeanShellInterpreter:调用bsh方法时出错:eval文件:内联评估://my beanshell script log.info("Example Sample"); String maVariable = vars.get( . . . '' Encountered ";" at line 8, column 22. and WARN - jmeter.protocol.java.sampler.BeanShellSampler: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval In file: inline evaluation of: //我的beanshell脚本log.info(“示例示例”); String maVariable = vars.get(...'''遇到过“;”第8行,第22栏。

我的代码是

//my beanshell script 
log.info("Example Sample");  
String maVariable = vars.get("VARIABLE_NAME");  
if (maVariable.equals("1")      
{

 ResponseCode = 2*100 ;

ResponseMessage=  "Okey" ;

 vars.put("NAME" , "VALUE") ; 

} 

return "Beanshell wrote this message";  

我搜索了它,我想我需要一些插件才能完成。我下载了其中一个,即bsh-2.0b2.jar,但我无法完成任务。 我不知道我哪里出错了,如果有人有任何想法请分享。在此先感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

在if语句中

你错过了结尾)。

if (maVariable.equals("1")  应该 if (maVariable.equals("1") )

验证我是否在50台用户在2台服务器上循环500次运行测试。这是Load Test and the JMX File