Jmeter性能测试之进阶BeanShell的使用

时间:2023-03-09 15:26:13
Jmeter性能测试之进阶BeanShell的使用

BeanShell 最常用的用法

写好Java代码打成jar, 放到目录\lib\ext下面

 package com.test;

 import java.io.File;
import java.io.UnsupportedEncodingException; public class Common {
public static String getPath(){
String path = Common.class.getProtectionDomain().getCodeSource().getLocation().getFile();
try {
path = java.net.URLDecoder.decode(path, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String jarPath = new File(path).getParentFile().getAbsolutePath();
return jarPath;
}
}

Jmeter性能测试之进阶BeanShell的使用

Jmeter性能测试之进阶BeanShell的使用