jmeter调用控制器中的其他线程组变量 [英] jmeter invoking other thread group variable in controller

查看:187
本文介绍了jmeter调用控制器中的其他线程组变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个测试计划中有2个Jmeter线程组.

Have 2 Jmeter threadgroups in a testplan.

Threadgroup 1
  Java sampler 1 
         - produce some messages
     Constant timer delay with 1000ms.

Threadgroup 2
  Java sampler 2 
        - Message will have 2 variables like "${var1} is going for walk in ${var2} ground"
     Constant timer delay with 60000ms.

每个线程组将有10个线程运行30分钟.

Each threadgroup will have 10 threads running for 30 mins.

但是Threadgroup 1线程将每秒产生消息. Threadgroup2线程将根据计时器的延迟每分钟生成一条消息.

But Threadgroup 1 threads willproduce meesage for every second. Threadgroup2 threads will produce messages for every minute based on delay in timer.

两个线程组都在并行运行

Both threadgroups are running parellaly

到目前为止,我能够使它工作.

This far I am able to get it worked.

但是我有一部分我不确定如何实现.第二个线程组2 Java采样器中的Var2是动态生成的.我需要基于相同线程号的var2值控制线程组1采样器.

But I have one portion which i am not sure how to implement that. Var2 in second threadgroup2 java sampler is dynamically generated one. I need to control my threadgroup 1 sampler based on this var2 value of the same threadnumber.

i.e If thread1 of second threadgroup2 var2 has value "abc", then thread1 in threadgroup2 should not execute. Untill same threadnumber in second threadgroup , changes the value. Only that particular thread number should get controlled.

Other threads should continue to execute. I tried to place while controller with var2 == "abc" & if controller . But did not see any change.

有什么办法解决这个问题吗?预先感谢.

Any idea how to resolve this? Thanks in advance.

推荐答案

我认为最快,最简单的解决方案是使用 FIFO队列,因此您可以暂停Java sampler 1执行直到满足条件,请参见 SynchronizationExample.jmx 测试计划以供参考.

I believe the fastest and the easiest solution would be using Inter-Thread Communication plugin which is basically a FIFO queue so you will be able to pause Java sampler 1 execution until your condition is met, see SynchronizationExample.jmx Test Plan for reference.

您可以通过两种方式安装线程间通信插件:

You can install Inter-Thread Communication Plugin in 2 ways:

  1. 手动下载 jpgc-fifo 软件包并将存档内容放置到JMeter安装的"lib"和"lib/ext"文件夹
  2. 使用 JMeter插件管理器 a>,在可用插件"选项卡上查找Inter-Thread Communication.这样,您还将收到有关此更新和其他插件更新的通知

  1. Manually downloading jpgc-fifo bundle and placing the content of the archive to "lib" and "lib/ext" folders of your JMeter installation
  2. Install it automatically using the JMeter Plugins Manager, look for Inter-Thread Communication at the "Available Plugins" tab. This way you will also be notified about this and other plugins updates

这篇关于jmeter调用控制器中的其他线程组变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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