Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify number of threads/users on command line for jmeter [duplicate]

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.

like image 419
Classified Avatar asked Jan 17 '18 00:01

Classified


1 Answers

  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:

  • Full List of Command-Line Options
  • Apache JMeter Properties Customization Guide
  • Overriding Properties Via Command-Line
like image 195
Dmitri T Avatar answered Sep 19 '22 21:09

Dmitri T