Kokki
Kokki

Reputation: 83

Running multiple Jmeter independent jmx tests in parallel from Java Code

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.

Upvotes: 1

Views: 120

Answers (1)

Dmitri T
Dmitri T

Reputation: 168157

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?

Upvotes: 1

Related Questions