Wednesday, September 13, 2017

Run JMeter in command line

Run JMeter in command line


There are use-cases where you cant use JMeter GUI to run the script.

Eg :- during distributed JMeter load testing, run jmx from a remote machine (just using command line)

Following are the steps which I followed to run JMeter script in command line.

1. Create JMeter script in your local machine.(yes, using the GUI ;) )
2. Setup JMeter in the remote machine.
  •  SCP apache-jmeter-X.XX.zip and created jmx in step 1.
3. Access remote machine using command line. (ssh ;))
4. Move and setup apache-jmeter-X.XX.zip and jmx according to your preference.

I have extracted  apache-jmeter-X.XX.zip inside my home directory(remote machine) and able to move to bin directory using,
cd /home/udara-aws/apache-jmeter-2.11/bin
Copied test.jmx script in to the same location.

Lets run this script in command line now.
sh jmeter.sh -n -t test.jmx -l log.jtl
Here we have used -n -t and -l arguments.

-n denotes �nongui run JMeter in nongui mode
-t denotes �testfile  jmx file which needs to run
-l denotes  �logfile file to put sampler logs (jtl)

Following is the output I got, If you are not getting summery results make sure to attach "Generate Summary Results" listener to relevant samplers.

udara@udara-aws:~/apache-jmeter-2.11/bin$ sh jmeter.sh -n -t test.jmx -l log.jtl
Creating summariser <summary>
Created the tree successfully using test.jmx
Starting the test @ Tue Nov 11 19:29:28 UTC 2014 (1415734168842)
Waiting for possible shutdown message on port 4445
summary +      1 in   3.3s =    0.3/s Avg:  3324 Min:  3324 Max:  3324 Err:     0 (0.00%) Active: 1 Started: 1 Finished: 0
summary +      6 in   4.1s =    1.5/s Avg:   676 Min:   124 Max:  1756 Err:     0 (0.00%) Active: 0 Started: 1 Finished: 1
summary =      7 in     8s =    0.9/s Avg:  1054 Min:   124 Max:  3324 Err:     0 (0.00%)
Generate Summary Results for list APIs =      1 in   1.1s =    0.9/s Avg:  1065 Min:  1065 Max:  1065 Err:     0 (0.00%)
Generate Summary Results for List Subscriptions =      1 in     1s =    1.6/s Avg:   637 Min:   637 Max:   637 Err:     0 (0.00%)
Tidying up ...    @ Tue Nov 11 19:29:36 UTC 2014 (1415734176890)
... end of run

download file now

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.