Jmeter - 每个采样器请求之前的增量值

Jmeter - Increment value before each sampler request

我在 jmeter 中有一些 SOAP 采样器的测试计划,我在其中附加到请求主体计数器值,我正在寻找如何在每个采样器请求之前增加计数器的方法。

在下面的设置中,jmeter 按以下顺序执行请求:

First Request - with counter 1
Second Request - with counter 1
First Request - with counter 2
Second Request - with counter 2

我想实现这种行为:

First Request - with counter 1
Second Request - with counter 2
Third Request - with counter 3
...
N Request - with counter n

用户数: 线程数:1 加速期:1 循环次数:2

计数器 起始值:1 增量:1 最大值:2

我该怎么做?我猜我应该以某种方式介绍循环控制器?

你可以这样做:

  • 在测试计划中,定义变量 "counter" 设置为 0

  • 然后添加一个User Parameters which is a PreProcessor (so executed BEFORE SAMPLER) component using __intSum函数

感谢scoping rules每次都会执行。

对于自动递增,在用户定义的变量中用 0 初始化一个变量,比如 "id",然后使用 ${__intSum(${id},1,id)} 作为自动递增如下所示:-