2017-02-22 90 views
0

在測試計劃中有2個Jmeter線程組。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線程將根據定時器的延遲時間生成每分鐘的消息。

兩個線程組的parellaly

運行這遠遠我能得到它的工作。

但我有一部分,我不知道如何實現。 Var2在第二個threadgroup2中,java sampler是動態生成的一個。我需要基於同一個線程號的這個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. 

任何想法如何解決這個問題?提前致謝。

回答

1

相信最快和最簡單的解決辦法是使用Inter-Thread Communication插件,它基本上是一個FIFO queue這樣你就可以暫停執行Java sampler 1,直到你的條件得到滿足,看到SynchronizationExample.jmx測試計劃以供參考。

可以安裝線程間通信插件在兩個方面:

  1. 手動下載jpgc-fifo包,並把檔案的內容,以「LIB」和「lib/ext目錄」你的JMeter的安裝文件夾
  2. 使用JMeter Plugins Manager自動安裝它,在「可用插件」選項卡上查找Inter-Thread Communication。你也將收到通知和其他插件這種方式更新

    JMeter Plugins Manager Inter Thread Communication

相關問題