Archive

Archive for October, 2009

JMeter: Run scripts from the console

October 29, 2009 7 comments

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: ,