user7264473
user7264473

Reputation: 163

jmeter invoking other thread group variable in controller

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.

Each threadgroup will have 10 threads running for 30 mins.

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.

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.

Upvotes: 0

Views: 347

Answers (1)

Dmitri T
Dmitri T

Reputation: 168072

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. 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 Plugins Manager Inter Thread Communication

Upvotes: 1

Related Questions