2012-10-31 27 views
1

我试图在eclipse中运行jmeter测试套件。
在我的测试套件中,我使用BeanShellAssertion来计算csv文件中的行数。
我有一个自定义jmeter函数来这样做。
的BeanShellAssertion的脚本是:从BeanShell声明脚本调用Jmeter函数

String str = "${__CustomFunction("Path to the CSV file")}"; 
int i = Integer.parseInt(str); 
if(i ==0) 
{ 
    Failure = true; 
    FailureMessage = "Failed!"; 
} 
return i; 

该测试套件工作正常,当我用我的本地机器上的JMeter的运行它。
只有当我尝试用eclipse运行它,(使用JMeter的Maven插件),我看到了以下错误:

jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: `` String str = "${__CustomFunction("FilePath")}"; int i = Integ . . . '' : Typed variable declaration : Method Invocation Integer.parseInt

我想知道如果使用eclipse执行时,它还有一些其他的方式来调用JMeter的功能因为我确信这个函数是正确的,正如我之前提到的那样,当我的本地机器上使用Jmeter运行测试套件时,它可以正常工作。

任何帮助,将不胜感激。 谢谢。

+0

关于这一点的任何消息,我的回答是好的,如果是的话,你应该接受它,如果没有请评论。 –

回答

1

你确定你的自定义函数jar对于Maven插件是可见的吗?

当你从JMeter运行它时,它可以工作,我猜你在lib/ext中有一个jar。

所以你需要使这个jar可用于jmeter maven插件。

+0

感谢您的回复。这么晚才回复很抱歉。是的,自定义jar对Maven插件是可见的。我尝试了很多工作,但不幸的是无法工作。 – dehsams123