【问题标题】:How to call Jmeter Counter Reference Name variable incrementing one如何调用 Jmeter 计数器参考名称变量递增一
【发布时间】:2018-04-13 22:32:43
【问题描述】:

在我的测试计划中,我使用 Counter 配置元素并配置了 start = 1、increment = 1、maximum = 4 和 ReferenceName = loopCount。

在采样器中,我也使用了 Json Extractor 来设置

Match No: ${loopCount} + 1 

因为在我提取的 Json 文件中,第一个匹配项总是为空。

不幸的是我觉得我不能像这样给它

${loopCount} + 1.

有什么办法可以解决这个问题吗?请帮忙。

【问题讨论】:

    标签: jmeter jmeter-3.2


    【解决方案1】:

    您可以在计数器配置元素之后添加BeanShell Sampler,在代码区域使用以下代码:

    int Counter = Integer.parseInt(vars.get("loopCount"));
    
    vars.put("Increment", String.valueOf(Counter+1));
    

    现在您可以使用变量${Increment} 作为匹配号。

    您可以使用${__intSum(${loopCount},1)} 直接将loopCount 变量的值加1。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-30
      • 1970-01-01
      • 2019-04-05
      • 2023-02-19
      • 2021-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多