1

I have a Java code that executes one JMX file at a time , it also produces the results. Now , I would like to leverage the code to run multiple JMX files at the same time. Is there way I could run multiple JMX scripts (each script is different) in parallel from JAVA CODE ? Please help me with this.

Kokki
  • 63
  • 1
  • 8
  • Are there config elements that can't be shared across threads? I'm curious if you curious if you can scope the inheritance at the thread group level. – Boni Aug 12 '21 at 15:42

1 Answers1

1

The simplest way is instantiating as many Thread objects as you need like:

for (int i = 0; i < how_many_threads_do_you_want; i++) {
    Thread thread = new Thread() {
        public void run() {
            //your code to run JMeter here
        }
    }
    thread.start();
}

For more complex scenarios like waiting for completion, inter-process communication, etc. see i.e. ExecutorService

Maybe instead of trying to re-invent the wheel you might want to use ready solutions like Taurus automation framework?

Dmitri T
  • 159,985
  • 5
  • 83
  • 133