Search code examples
javajmeterjmeter-plugins

Running Jmeter testplan in non GUI mode


I have created some test plans in Jmeter. Now I need to run them trough command line or java API.

Can anyone please suggest any links or examples on from CLI/JAVA API how to:

  1. Start jmeter
  2. Load the *.jmx [testplan] plan
  3. Specify number of threads
  4. Start the test
  5. Redirect the output result xml to result directory.

Solution

  • In addition to previous comment on how to run JMeter in non-GUI mode, number of threads can be passed as JMeter property as follows:

    In Thread Group set "Number of Threads" to be ${__property(users,,)}

    and set it as

    jmeter -Jusers=50 -n -t Test_Plan.jmx -l results_folder\log.jtl
    

    See Apache JMeter Properties Customization Guide for more details.

    In regards to running JMeter test from Java code refer to this thread.

    For running JMeter scripts from Apache Ant there is JMeter Ant Task

    For running JMeter by Maven there is a JMeter Maven plugin

    There is also Jenkins plugin if you want to integrate it with Jenkins/Hudson