在Jmeter中的ForEach控制器中传递两个变量 [英] Passing two variables in a ForEach controller in jmeter

查看:1609
本文介绍了在Jmeter中的ForEach控制器中传递两个变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个ForEach控制器,在该控制器中,我希望该控制器在其下运行服务以更改纬度和经度集.例子-

I am running a ForEach controller in which I want the controller to run the service underneath it for changes in sets of latitudes and longitudes. example-

输入变量前缀:latitude

输出变量名称:Latitude

我想运行控制器以同时更改纬度"和经度".我尝试这样做-

I want to run the controller for changes in both "latitude" and "longitude". I tried doing this-

输入变量前缀:latitude, longitude

但是它不起作用.还有其他方法可以在ForEach控制器中传递两个变量吗?

but it does not work. Is there any other way to pass two variables in ForEach controller?

推荐答案

不幸的是,您无法使用ForEach Controller做到这一点,但是您可以使用 __counter ()功能组合.

Unfortunately you cannot do it using ForEach Controller, but you can work it around using __V() and __counter() function combination.

例如,您有4个JMeter变量:

For example you have 4 JMeter Variables:

latitude_1=40.7128° N
longitude_1=74.0059° W
latitude_2=32.0853° N
longitude_2=34.7818° E

您想使用ForEach Controller对其进行迭代.在这种情况下,相关配置为:

And you want to iterate them both using ForEach Controller. In that case the relevant configuration would be:

  • 输入变量前缀:latitude
  • 输出变量名称:任何有意义的变量,例如current_latitude
  • Input variable prefix: latitude
  • Output variable name: anything meaningful, i.e. current_latitude

您可以使用以下表达式引用匹配的经度值:

You can refer matching longitude value using the following expression:

${__V(longitude_${__counter(,)})}

演示:

请参见此处介绍的内容要合并多个JMeter变量,以详细说明上述表达式的来源.

See Here’s What to Do to Combine Multiple JMeter Variables for detailed explanation of where did the above expression come from.

这篇关于在Jmeter中的ForEach控制器中传递两个变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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