Open GenweiWu opened 10 months ago
__time
{
"eventTime": ${__time(,)},
"type": "设备标识_${__Random(1,10,)}"
}
Function | Example | Description |
---|---|---|
${__time()} | 1603188484750 | Current Time in Epoch Format in milliseconds |
${__time(/1000)} | 1603188484 | Current Time in Epoch Format in seconds |
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.:
Set your source variable (via e.g. User Defined Variables):
Name Value categories 3,2,54,42,37
(i.e. use comma as delimiter, no spaces before and after comma).
Use add BeanShell Sampler/PostProcessor with the following code:
import java.util.Random; String[] categories = (vars.get("categories")).split(","); int idx = new Random().nextInt(categories.length); String category = (categories[idx]); vars.put("categoryId", category);
${categoryId}
.
安装类
配置上网代理