【问题标题】:jmeter invoking other thread group variable in controllerjmeter在控制器中调用其他线程组变量
【发布时间】:2017-02-22 13:36:52
【问题描述】:

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

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 分钟。

但是线程组 1 线程每秒会产生消息。 Threadgroup2 线程将根据定时器的延迟每分钟产生消息。

两个线程组并行运行

到目前为止,我能够让它工作。

但我有一部分不知道如何实现。第二个threadgroup2 java sampler中的var2是动态生成的。我需要根据同一个线程号的这个 var2 值来控制我的线程组 1 采样器。

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.

知道如何解决这个问题吗?提前致谢。

【问题讨论】:

    标签: java multithreading jmeter


    【解决方案1】:

    我相信最快和最简单的解决方案是使用Inter-Thread Communication 插件,它基本上是一个FIFO queue,因此您可以暂停Java sampler 1 执行直到满足您的条件,请参阅SynchronizationExample.jmx 测试计划以供参考.

    您可以通过两种方式安装Inter-Thread Communication Plugin:

    1. 手动下载 jpgc-fifo 包并将存档内容放置到 JMeter 安装的“lib”和“lib/ext”文件夹中
    2. 使用JMeter Plugins Manager 自动安装它,在“可用插件”选项卡中查找Inter-Thread Communication。这样您也会收到有关此插件和其他插件更新的通知

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-25
      • 2023-03-21
      • 2017-12-03
      • 1970-01-01
      相关资源
      最近更新 更多