GenweiWu / Blog

个人技术能力提升
MIT License
4 stars 0 forks source link

jmeter #93

Open GenweiWu opened 10 months ago

GenweiWu commented 10 months ago

安装类

配置上网代理

https://jmeter.apache.org/usermanual/get-started.html#proxy_server
写一个脚本,传递代理信息

//N表示不使用代理的地址
jmeter.bat -E https -H my.proxy.server -P 8000 -u username -a password -N "127.0.0.1|10.*.*.*"
GenweiWu commented 10 months ago

动态变量

🚗 当前时间戳 __time

{
  "eventTime": ${__time(,)},
  "type": "设备标识_${__Random(1,10,)}"
}

https://jmeter.apache.org/usermanual/functions.html#__time

Function Example Description
${__time()} 1603188484750 Current Time in Epoch Format in milliseconds
${__time(/1000)} 1603188484 Current Time in Epoch Format in seconds
GenweiWu commented 9 months ago

从list中随机选取一个值

https://stackoverflow.com/a/14697471/6182927

Concerning implementing ${__StringFromArrayAtRandomIndex('3', '2', '54', '42')}.

Suppose you can easily implement your scenario using e.g. BeanShell Sampler / BeanShell PostProcessor with a bit of code.

E.g.: