9

Is there a way to specify # of threads on the command line when running Jmeter load tests from the command line/non-GUI mode? I looked at the Jmeter manual and there didn't appear to be an option to specify on the command line. There was mention of a property file but again, I don't know how to specify that in the property file to be used by Jmeter.

What I need to do is in non-GUI mode, specify the number of threads I want to run for that test on the command line.

The two hokey work arounds I am thinking of doing are:

  1. Use sed to edit the jmx file in my script with the number of users I want to test with
  2. Have X number of jmx files, each with a hard coded number of users to test with, and then pass that to Jmeter to test.

Thanks in advance for your help.

Classified
  • 5,759
  • 18
  • 68
  • 99

1 Answers1

25
  1. You can define number of threads usin __P() function like ${__P(threads,)}
  2. The aforementioned threads property can be overridden from the command line using -J argument like:

    jmeter -Jthreads=1000 -n -t test.jmx -l result.jtl
    

Storing property in file is also possible, just add the next line to user.properties file (located in "bin" folder of your JMeter installation)

threads=1000

and next time you start JMeter it will pick the property up and apply it.

More information:

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • 1
    does threads correlate to the Thread Group field "Number of Threads (users)"? I tried saving a jmx with that set to 1, and then launched both with -Jthreads=1000 and an entry on user.properties but it was still executing only one thread for the thread group. – Evan Morrison Dec 17 '20 at 01:01