在我的测试计划中,我正在使用Counter配置元素并配置了start = 1,increment = 1,maximum = 4和ReferenceName = loopCount .
在采样器中,我也使用了Json Extractor,我想设置它
Match No: ${loopCount} + 1
因为在Json文件中我总是提取第一个匹配为空 .
不幸的是我觉得我不能给它喜欢
${loopCount} + 1.
对此有任何解决方法..请帮忙 .
您可以在 Counter config element 之后使用以下代码在代码区域中添加BeanShell Sampler:
int Counter = Integer.parseInt(vars.get("loopCount")); vars.put("Increment", String.valueOf(Counter+1));
现在你可以使用变量 ${Increment} 作为匹配号
${Increment}
OR
您可以使用 ${__intSum(${loopCount},1)} ,它将直接将loopCount变量的值加1 .
${__intSum(${loopCount},1)}
1 回答
您可以在 Counter config element 之后使用以下代码在代码区域中添加BeanShell Sampler:
现在你可以使用变量
${Increment}
作为匹配号OR
您可以使用
${__intSum(${loopCount},1)}
,它将直接将loopCount变量的值加1 .