質問

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.
役に立ちましたか?

解決

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

他のヒント

Now i need to run them trough command line or java API

For running a jmeter test plan through CLI, you want a couple flags --

jmeter -n -t Test_Plan.jmx -l log.jtl

-n - Non gui mode

-t location of the test plan

-l log file to output

Specify number of threads

This is actually built into the test plan - you would want to edit the .jmx test plan to change the number of threads.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top