jmeter个人学习之路--时间函数
来源:互联网 发布:外国人抢购的国货知乎 编辑:程序博客网 时间:2024/06/05 01:57
有时在接口测试时,其参数需要为时间戳或者是日期格式的数据。针对此问题,可以使用JMeter自带的_time 函数来解决以上问题
操作步骤:
1、通过函数助手,生成一个_time 函数:
2、如果参数为时间戳,那公式为:
${__time(,)} : 默认该公式精确到毫秒级别, 13位数
${__time(/1000,)} : 该公式精确到秒级别, 10位数
3、 如果参数需要为当前日期,那公式为:
${__time(yyyy-MM-dd,)}
${__time(YMDHMS,)}
4、执行结果为:
常用于带时间戳的地方
比如:带时间戳的结果文件,每次运行生成独立文件
官网原文:
19.5.17 __time
The time function returns the current time in various formats.
Parameters
Attribute Description Required FormatThe format to be passed to SimpleDateFormat. The function supports various shorthand aliases, see below. If ommitted, the function returns the current time in milliseconds since the epoch.NoName of variableThe name of the variable to set.NoIf the format string is omitted, then the function returns the current time in milliseconds since the epoch. In versions of JMeter after 2.7, if the format matches "/ddd" (where ddd are decimal digits), then the function returns the current time in milliseconds divided by the value of ddd. For example, "/1000" returns the current time in seconds since the epoch. Otherwise, the current time is passed to SimpleDateFormat. The following shorthand aliases are provided:
- YMD = yyyyMMdd
- HMS = HHmmss
- YMDHMS = yyyyMMdd-HHmmss
- USER1 = whatever is in the Jmeter property time.USER1
- USER2 = whatever is in the Jmeter property time.USER2
The defaults can be changed by setting the appropriate JMeter property, e.g. time.YMD=yyMMdd
- jmeter个人学习之路--时间函数
- jmeter个人学习之路-时间函数精准计算
- jmeter个人学习之路--jmeter常用函数整理
- jmeter个人学习之路--jmeter结果分析
- jmeter个人学习之路--参数化设置
- jmeter个人学习之路--检查点(断言)
- jmeter个人学习之路--badboy录制脚本
- jmeter个人学习之路--工具简单介绍
- jmeter个人学习之路--常见问题及解决方案
- jmeter函数之时间函数__time
- jmeter函数之时间函数__time
- jmeter个人学习之路--元件的作用域与执行顺序
- jmeter时间函数--时间函数偏移
- jmeter学习之路一:学会使用jmeter API
- JMeter学习(十六)JMeter函数学习
- Jmeter函数之 _CSVRead
- Jmeter函数之_StringFromFile
- Jmeter之函数助手
- Java多线程和并发性知识点总结
- 邮箱验证码功能实现
- 基于VS2013MFC的JSON文件的写入和解析
- 关于 Overtrue 的拼音库 overtrue/pinyin 为何 travis 为 error【社交系统研发日记十】
- DTS结构及其编译方法
- jmeter个人学习之路--时间函数
- Linux下librtmp使用及编程实战
- 基于卷积神经网络的图像语义分割
- vc6.0/vs2010/vs2012/vs2013等的bug——sprintf,sprintf_s
- 分布式事务
- chrome及Firefox各版本浏览器下载地址
- 100万条数据库只要1s,备用
- 如何在Android Studio中导进其他的Android项目
- WIN10家庭版用户名修改