我的 jmeter 测试发出一个包含唯一 ID 的 http 请求。
http://myserver.com/{uniqueId}/
我想为每个线程设置基数(比如 35000)和增量,例如我的 id 是 35001、35002、35003 ...
http://myserver.com/{base + count}
我看到 __threadnum 和 __counter 的函数,但我会如何:
- 将其设置在变量中,以便我可以在我的网址中替换它
- 将此计数添加到我的基值中
我会简单地使用 Beanshell 预处理器。
int threadNo = ctx.getThreadNum()+1; //to get the thread number in beanshell
int base = 35000;
int uniqueId = threadNo + base;
vars.put("uniqueId", Integer.toString(uniqueId));
现在,您的 HTTP 请求(如下所示)应该替换该值。
http://myserver.com/ http://myserver.com/${uniqueId}/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)