Jmeter, Name and value pairs are dynamic in jmeter

故事扮演 提交于 2020-01-23 11:25:06

问题


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 .

Regards, Sai


回答1:


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

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

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})}

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));

And use it later

${__V(Value_${idx})}


来源:https://stackoverflow.com/questions/50796787/jmeter-name-and-value-pairs-are-dynamic-in-jmeter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!