Home > jmeter > JMeter: Run scripts from the console

JMeter: Run scripts from the console

Running Jmeter scripts from the console is one way of reducing the resources needed to execute the load as compared to a GUI mode.

From the console, we say:
jmeter -n -t <testplan filename> -l <listener filename>
(e.g. jmeter -n -t testplan.jmx -l listener.jtl)

The first time I tried to run my scripts from the command line, this is what I exactly saw:

D:\Jmeter\bin>jmeter -n -t testplan.jmx -l listener.jtl
 Created the tree successfully using testplan.jmx
 Starting the test @ Fri Oct 28 07:50:29 CST 2009 (1256255429500)
 Waiting for possible shutdown message on port 4445
 Tidying up ...    @ Fri Oct 28 07:50:34 CST 2009 (1256255434468)
 ... end of run

This information tells us that execution was successful. But if I wanted to see more results of the test, Jmeter provides a listener that displays the summary results also from the console where we type our commands.

We do this by adding the “Generate Summary Results” listener in our testplan.

generate results

Again we type the same command in the console:


D:\Jmeter\bin>jmeter -n -t testplan.jmx -l listener.jtl
Created the tree successfully using testplan.jmx
Starting the test @ Thu Oct 29 11:23:49 CST 2009 (1256786629265)
Waiting for possible shutdown message on port 4445
Generate Summary Results +     5 in   8.5s =    0.6/s Avg:   981 Min:   296 Max:  2344 Err:     0 (0.00%)
Generate Summary Results +     1 in   0.2s =    4.3/s Avg:   232 Min:   232 Max:   232 Err:     0 (0.00%)
Generate Summary Results =     6 in   9.6s =    0.6/s Avg:   856 Min:   232 Max:  2344 Err:     0 (0.00%)
Tidying up ...    @ Thu Oct 29 11:24:02 CST 2009 (1256786642453)
... end of run

From here we could clearly see the results happening per thread which I prefer more than the first.

Here are some commands that we could use when running test in nonGUI mode:

-h, –help -> prints usage information and exit
-n, –nongui -> run JMeter in nongui mode
-t, –testfile <argument> -> the jmeter test(.jmx) file to run
-l, –logfile <argument> -> the file to log samples to
-r, –runremote -> Start remote servers (as defined in remote_hosts)
-H, –proxyHost <argument> -> Set a proxy server for JMeter to use
-P, –proxyPort <argument> -> Set proxy server port for JMeter to use

example:

jmeter -n -t test1.jmx -l logfile1.jtl -H 192.168.1.1 -P 8080

could clearly see the results per thread which I prefer more than the first.

Advertisements
Categories: jmeter Tags: ,
  1. Ying
    March 28, 2012 at 4:03 pm

    It’s really good.

  2. Abhishek
    April 23, 2012 at 7:48 pm

    great job buddy. For beginners with jmeter especially at Linux its a really good find. Thanks

  3. Dzmitry Kashlach
    September 3, 2012 at 6:42 pm

    Thank you for the article!

    Some good tips of getting results while running JMeter in non-GUI mode
    http://blazemeter.com/blog/top-2-techniques-get-jmeter-test-results-non-gui-mode

  4. July 5, 2013 at 4:58 pm

    Hi,

    please tell me/ suggest

    what is the correct way of preparing jmeter script?

    Should i used httpRequest sampler ?

    or

    should i used recording for preparing jmeter script?

    I had a confusion because of both way gives me the average response time 5sec and 40 sec.

    please suggest the ways so, I will able to prepare jmeter script.

    Thanks
    puneet

  5. Ashneet
    July 31, 2014 at 2:49 am

    When I run this command I get command not found error. Why I am getting an error?

  6. dk tester
    August 8, 2014 at 8:54 pm

    How to save this report?

  1. November 9, 2011 at 6:57 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: