标签:div 变量 and 需要 new ring class ati dom
变量mynation从列表{"china","US","UK"}中随机取值
String[] nation = new String[]{"china","US","UK"}; Random random = new Random(); int i = random.nexInt(nation.length); vars.put("mynation",nation[i]);
在需要使用的地方直接${mynation}引用即可
如果要设置两个变量且变量值随机但不重复,可以通过两个列表放置不同值实现
String[] nation = new String[]{"china","US","UK"}; Random random = new Random(); int i = random.nextInt(nation.length); vars.put("mynation",nation[i]); String[] num = new String[]{"8","2","1","7"}; Random r = new Random(); int j = r.nextInt(num.length); vars.put("anum",num[j]);
Jmeter使用Beanshell预处理器从指定列表中获取随机值
标签:div 变量 and 需要 new ring class ati dom
原文地址:https://www.cnblogs.com/susanhonly/p/9945996.html