Jmeter BeanShell简单应用(一)

Posted on 2017-07-14 17:04  CatherineJin  阅读(139)  评论(0)    收藏  举报

 

java代码实现如下:

package Encrypt;

public class FirstTry {
    String result = "";
    public String getResult() {
        return this.result;
    }
    
    public void setResult(String str) {
        this.result = str + "test success";
    }
    
    public int add(int a, int b) {
        return a + b;
    }
}

打包后放在:\apache-jmeter-3.2\lib\ext 路径中。

运行Jmeter,在测试计划(test plan下配置):

 

 在BeanShell Sampler中实现代码如下:

 

运行结果:

 

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3