快来学习吧!!!

luckydays

快来学习吧!!!

玩转----jmeter函数助手

##常用函数的介绍

__time 函数

获取系统的当前时间 image_1cs6ok13j1ru1nsg1e2t1ormuep9.png-52.6kB

函数参数描述
Format string for SimpleDateFormat (optional)格式 设置时间所采用的格式
Name of variable in which to store the result (optional)变量名 存储结果的变量名称

如果省略了格式字符串,time函数会返回当前时间的毫秒级时间戳。 time函数包含以下时间格式

  • YMD = yyyyMMdd。 image_1cs6p31gv4531l2461pe741k511j.png-16.1kB
  • HMS = HHmmss。 image_1cs6p48d31h8corv1c671gaf1mkk20.png-13.8kB
  • YMDHMS = yyyyMMdd-HHmmss。 image_1cs6p259ffc1624j1ccpq1sv016.png-18.2kB
  • 也可以加入字符修改样式 image_1cs6p7spd19lu1lt31bim1rlkftr2d.png-17.3kB
  • 用户可以通过修改JMeter属性来改变默认格式,例如,time.YMD=yyMMdd。

time毫秒时间戳转秒时间戳 image_1cs6phinrnj31cs91d6k8nabib3a.png-93kB

__Random 函数

生成随机数

函数参数描述
FThe minimum value allowed for a range of value 随机数取值范围的最小值
The maximum value allowed for a range of values 取值范围的最大值
Name of variable in which to store the result (optional) 存储结果的变量名称
  • 在1000-10000之间生成随机数

image_1cs6pv0thi0fdko692rgfqqs3n.png-91.7kB

__RandomString

随机生成字符串

函数参数描述
Random string length 随机字符串的长度
Chars to use for random string generation 用来生成随机字符串的字符
Name of variable in which to store the result (optional) 存储结果的变量名称

__RandomDate

随机生成日期

函数参数描述
Format string for DateTimeFormatter (optional) (default yyyy-MM-dd) 日期格式 默认yyyy-mm-dd
Start date (optional) (default: now) 随机日期的开始日期,默认为现在
End date 结束日期
String format of a locale (ex: fr_FR , en_EN) (optional) 语言区域
Name of variable in which to store the result (optional) 存储结果的变量名称

image_1cs815tao97jpdaut453g12h4p.png-69.1kB

__threadNum

返回当前线程的编号

posted @ 2020-01-05 20:44  luckydays  阅读(246)  评论(0编辑  收藏  举报