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

Posted 捏不死的小蚂蚁

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Jmeter性能测试之进阶BeanShell的使用相关的知识,希望对你有一定的参考价值。

BeanShell 最常用的用法

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

 1 package com.test;
 2 
 3 import java.io.File;
 4 import java.io.UnsupportedEncodingException;
 5 
 6 public class Common {
 7     public static String getPath(){
 8         String path = Common.class.getProtectionDomain().getCodeSource().getLocation().getFile();
 9         try {
10             path = java.net.URLDecoder.decode(path, "UTF-8");
11         } catch (UnsupportedEncodingException e) {
12             e.printStackTrace();
13         }
14         String jarPath = new File(path).getParentFile().getAbsolutePath();
15         return jarPath;
16     }
17 }

 

以上是关于Jmeter性能测试之进阶BeanShell的使用的主要内容,如果未能解决你的问题,请参考以下文章