用于http请求的每个线程的jmeter唯一id

Bar*_*rry 4 jmeter

我的jmeter测试会生成一个包含唯一ID的http请求.

http://myserver.com/{uniqueId}/
Run Code Online (Sandbox Code Playgroud)

我想为每个线程设置基数(比如35000)和增量,例如我的ids将是35001,35002,35003 ......

http://myserver.com/{base + count}
Run Code Online (Sandbox Code Playgroud)

我看到了__threadnum和__counter的函数但是我怎么做:

  1. 将它设置在一个变量中,以便我可以在我的url中替换它
  2. 将此计数添加到我的基值

vin*_*ins 9

我只想使用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));
Run Code Online (Sandbox Code Playgroud)

现在,您在下面给出的HTTP请求应该替换值.

http://myserver.com/ $ {uniqueId} /