0
votes

Is there any way to run two ThreadGroup consecutively in a loop for a certain amount of time? I am writing a test scenario in which I have to create a task for multiple users and then fulfill this task by them. Therefore, I decided to divide the scenario into two thread groups, because it needs one user to create a task and many users to complete it. Everything works fine, but the problem arises when I try to run the test in several iterations.

I tried to check Run Test Group consecutively check-box, but tests instead of performing alternately, e.g.

ThreadGroup 1
ThreadGroup 2
ThreadGroup 1
ThreadGroup 2

perform as follows

ThreadGroup 1
ThreadGroup 1
ThreadGroup 2
ThreadGroup 2

Is it possible to somehow make thread groups execute alternately? I would be very grateful for any advice.

1

1 Answers

1
votes

If you want to run multiple iterations you need to let thread group 2 know that the task is ready and let thread group 1 know that the task is compete and it's ok to generate a new task.

There are 2 approaches of passing data between Thread Groups:

  1. __setProperty() function to create/update a value in one Thread Group and __P() function to read the value in another Thread Group
  2. Inter-Thread Communication Plugin, see SynchronizationExample.jmx for reference implementation