Jmeter,名称和值对在Jmeter中是动态的 [英] Jmeter, Name and value pairs are dynamic in jmeter

查看:141
本文介绍了Jmeter,名称和值对在Jmeter中是动态的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的情况是名称和值对是动态的, 我分别对名称和值进行了两个关联. 我已经使用了foreach控制器,并将输入值作为值" regularexpression的引用名称.正确执行循环作为Value的匹配数. ForEach控制器的输入索引为"Cor_OutputValue",输出索引为"Cor_OutputValue1".

I have situation where name and value pair are dynamic, I did two correlations for name and Value separately. I have used foreach controller and gave input-value as reference name of "Value" regularexpression. which is executing the loop correctly as the match number of Value. ForEach controller input index is "Cor_OutputValue" and output index is "Cor_OutputValue1".

问题是如何更改每个请求的名称".

Problem is how do i change the "Name" for each request .

关于, 赛

推荐答案

ForEach控制器将循环索引保存在可以使用的特殊变量中:

ForEach Controller save index of loop in a special variable you can use:

JMeter将循环索引显示为名为 jm __ idx的变量.因此,例如,如果您的循环控制器名为FEC,则可以通过$ {__ jm__FEC__idx}访问循环索引.索引从0开始

JMeter will expose the looping index as a variable named jm__idx. So for example, if your Loop Controller is named FEC, then you can access the looping index through ${__jm__FEC__idx}. Index starts at 0

因此,如果您的控制器名称为ForEach Controller以获得相应的Value变量值,请使用

So in case of your controller name is ForEach Controller to get corresponding value of Value variable use __V function:

${__V(Value_${__jm__ForEach Controller__idx})}

如果您的值以索引1开头,则可以像JSR223 PreProcessor中的idx一样递增其他变量:

If your values start with index 1 you can increment different variable,as idx inside JSR223 PreProcessor:

vars.put("idx", String.valueOf(Integer.parseInt(vars.get("__jm__ForEach Controller__idx"))+1));

并在以后使用

${__V(Value_${idx})}

这篇关于Jmeter,名称和值对在Jmeter中是动态的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆