Jmeter 参数化 Load testing
2020-10-15 本文已影响0人
妍君_2662
1.场景:对注册接口进行100次压测。
2.如何实现
2.1 添加采样器 BeanShell Sampler,并在中填写对应的操作

2.2 设置变量
phone={__Random(1,100000,)};
String a = "796" + String.valueOf(phone); //将phone转为字符串,因为手机号的要求类型为char
vars.put("phone",a); //将字符串a设置为变量
vars.get("phone"); //在debug sample中查看phone的取值
log.info("the phone is:"+a); //在logview中打印查看取值

2.3 将设置的变量添加到请求中

2.4 添加“查看结果树”来查看运行结果,和添加“Bebug Sampler”来查看phone的取值
