Jmeter性能测试工具学习(Jmeter中的函数和BeanShell)

版权声明:版权归作者所有转载请标明出处https://blog.csdn.net/moveym https://blog.csdn.net/moveym/article/details/82841896

函数

loadrunner中的函数

Jmeter中的函数

1)函数格式 ${__functionName(var1,var2,var3)}

2)如果函数没有参数,那可以没有括号 例如 ${__threadNum}

例子:

BeanShell

BeanShell是一种完全符合Java语法规范的脚本语言,并且又拥有自己的一些语法和方法。

BeanShell是一种松散类型的脚本语言(这点和JS类似)。

BeanShell是用Java写成的,一个小型的、免费的、可以下载的、嵌入式的Java源代码解释器, 具有对象脚本语言特性。

BeanShell执行标准Java语句和表达式,另外包括一些脚本命令和语法。

The full list of BeanShell variables that is set up is as follows:

 log - the Logger

 Label - the Sampler label

 FileName - the file name, if any

 Parameters - text from the Parameters field

 bsh.args - the parameters, split as described above

 SampleResult - pointer to the current SampleResult

 ResponseCode = 200  ResponseMessage = "OK"

 IsSuccess = true

 ctx - JMeterContext

 vars - JMeterVariables - e.g. vars.get("VAR1"); vars.put("VAR2","value"); vars.remove("VAR3"); vars.putObject("OBJ1",new Object());

 props - JMeterProperties (class java.util.Properties)- e.g. props.get("START.HMS"); props.put("PROP1","1234");

猜你喜欢

转载自blog.csdn.net/moveym/article/details/82841896