jmeter函数介绍(1)


1、_Random() 随机数

 

The minimum value allowed for a range of values:输入一个最小值;

The maximum value allowed for a range of values:输入一个最大值;

Name of variable in which to store the result (optional):储存一个随机生成常量的变量,可以被引用;

点击Generate生成函数${__Random(1,999,Num)},解释:随意生成一个1-999之间的数值被Num变量储存;

2、_RandomString() 随机字符串

 

Random string length:随机字符的长度,2代表两个字符

Chars to use for random string generation:字符类型,可以是纯数字,纯字符,字符字母数字组合

Name of variable in which to store the result (optional):随机生成的字符被变量保存

${__RandomString(2,abcdefg,name)},解释:随机生成一个2位长度的字符串被name保存;(可填可不填)

3、_time() 时间(可以是时间格式、时间戳)

 

Format string for SimpleDateFormat (optional):时间格式,支持,年yyyy,月MM,日dd,时hh,分mm,秒ss,毫秒sss,之间任意符号连接,/1000就是10位时间戳(精确到秒),不填就是精确到毫秒13位时间戳;

Name of variable in which to store the result (optional):保存任意时间格式的标量,可被引用;

${__time(/1000,time)} 解释:精确到秒的10位时间戳;

${__time(,)}  :  默认该公式精确到毫秒级别, 13位数时间戳

4、_javaScript() java脚本函数

JavaScript expression to evaluate: 支持javascript脚本的表达式,如9+8,9*7...如Date()...

Name of variable in which to store the result(optional):储存值的变量,可直接引用,如${now}

点击Generate生成${__javaScript(Date(),now)},结果就是获取当前系统时间;


转载链接:https://blog.csdn.net/weixin_40543143/article/details/80746611

原文地址:https://www.cnblogs.com/mumulog/p/11477200.html