jemter 随机取数组里面的值放入请求

使用前置beanshell

String[][] index = {{"广东省","深圳市","龙岗区"},{"浙江省","杭州市","滨江区"}};
int i=${__Random(0,1,)};
log.info(index[i][0]);
log.info(index[i][1]);
log.info(index[i][2]);
vars.put("province",index[i][0]);
vars.put("city",index[i][1]);
vars.put("district",index[i][2]);

 

请求体调用:

{
"age":"${__Random(1,99,)}",
"schoolName":"123",
"grade":"幼儿园小班",
"userClass":"2班",
"province":"${province}",
"city":"${city}",
"district":"${district}",
}

上一篇:jQuery实现省市区三级联动(本地json文件)


下一篇:利用Vue实现天气预报