Monday, September 16, 2013

CUI Execution Process- JMeter


CUI Execution Process-JMeter

Non GUI Mode (Command Line Mode) Execution:

For non-interactive testing, you may choose to run JMeter without the GUI. To do so, use the following command options

-n This specifies JMeter is to run in non-gui mode

-t [name of JMX file that contains the Test Plan].

-l [name of JTL file to log sample results to].

-j [name of JMeter run log file].

-r Run the test in the servers specified by the JMeter property "remote_hosts"

-R [list of remote servers] Run the test in the specified remote servers

The script also lets you specify the optional firewall/proxy server information:

-H [proxy server hostname or ip address]
-P [proxy server port]


Example: jmeter -n -t my_test.jmx -l log.jtl -H my.proxy.server -P 8000

If the property jmeterengine.stopfail.system.exit is set to true (default is false), then JMeter will invoke System.exit(1) if it cannot stop all threads. Normally this is not necessary.

Server Mode:

For distributed testing, run JMeter in server mode on the remote node(s), and then control the server(s) from the GUI. You can also use non-GUI mode to run remote tests. To start the server(s), run jmeter-server/jmeter-server.bat on each server host.

The script also lets you specify the optional firewall/proxy server information:

-H [proxy server hostname or ip address]
-P [proxy server port]

Example: jmeter-server -H my.proxy.server -P 8000

If you want the server to exit after a single test has been run, then define the JMeter property server.exitaftertest=true.

To run the test from the client in non-GUI mode, use the following command:

 

jmeter -n -t testplan.jmx -r [-Gprop=val] [-Gglobal.properties] [-Z]

where:

-G is used to define JMeter properties to be set in the servers

-X means exit the servers at the end of the test

-Rserver1,server2 - can be used instead of -r to provide a list of servers to start

  Overrides remote_hosts, but does not define the property.

 

If the property jmeterengine.remote.system.exit is set to true (default is false), then JMeter will invoke System.exit(0) after stopping RMI at the end of a test. Normally this is not necessary.

Overriding properties via command line:

Java system properties, JMeter properties, and logging properties can be overriden directly on the command line (instead of modifying jmeter.properties). To do so, use the following options:

-D[prop_name]=[value] - defines a java system property value.

-J[prop name]=[value] - defines a local JMeter property.

-G[prop name]=[value] - defines a JMeter property to be sent to all remote servers.

-G[propertyfile] - defines a file containing JMeter properties to be sent to all remote servers.

-L[category]=[priority] - overrides a logging setting, setting a particular category to the given priority level.

The -L flag can also be used without the category name to set the root logging level.

Examples:

 
jmeter -Duser.dir=/home/mstover/jmeter_stuff \
    -Jremote_hosts=127.0.0.1 -Ljmeter.engine=DEBUG
 
jmeter -LDEBUG

Full List of command line options:

Invoking JMeter as "jmeter -?" will print a list of all the command-line options. These are shown below.

 
        -h, --help
                print usage information and exit
        -v, --version
                print the version information and exit
        -p, --propfile {argument}
                the jmeter property file to use
        -q, --addprop {argument}
                additional property file(s)
        -t, --testfile {argument}
                the jmeter test(.jmx) file to run
        -j, --jmeterlogfile {argument}
                the jmeter log file
        -l, --logfile {argument}
                the file to log samples to
        -n, --nongui
                run JMeter in nongui mode
        -s, --server
                run the JMeter server
        -H, --proxyHost {argument}
                Set a proxy server for JMeter to use
        -P, --proxyPort {argument}
                Set proxy server port for JMeter to use
        -u, --username {argument}
                Set username for proxy server that JMeter is to use
        -a, --password {argument}
                Set password for proxy server that JMeter is to use
        -J, --jmeterproperty {argument}={value}
                Define additional JMeter properties
        -G, --globalproperty (argument)[=(value)]
                Define Global properties (sent to servers)
                e.g. -Gport=123
                 or -Gglobal.properties
        -D, --systemproperty {argument}={value}
                Define additional System properties
        -S, --systemPropertyFile {filename}
                a property file to be added as System properties
        -L, --loglevel {argument}={value}
                Define loglevel: [category=]level 
                e.g. jorphan=INFO or jmeter.util=DEBUG
        -r, --runremote (non-GUI only)
                Start remote servers (as defined by the jmeter property remote_hosts)
        -R, --remotestart  server1,... (non-GUI only)
                Start these remote servers (overrides remote_hosts)
        -d, --homedir {argument}
                the jmeter home directory to use
        -X, --remoteexit
                Exit the remote servers at end of test (non-GUI)
 

Note: the JMeter log file name is formatted as a SimpleDateFormat (applied to the current date) if it contains paired single-quotes, .e.g. 'jmeter_'yyyyMMddHHmmss'.log'

If the special name LAST is used for the -t, -j or -l flags, then JMeter takes that to mean the last test plan that was run in interactive mode.

Non GUI shut down:

Prior to version 2.5.1, JMeter invoked System.exit() when a non-GUI test completed. This caused problems for applications that invoke JMeter directly, so JMeter no longer invokes System.exit() for a normal test completion. [Some fatal errors may still invoke System.exit()] JMeter will exit all the non-daemon threads it starts, but it is possible that some non-daemon threads may still remain; these will prevent the JVM from exitting. To detect this situation, JMeter starts a new daemon thread just before it exits. This daemon thread waits a short while; if it returns from the wait, then clearly the JVM has not been able to exit, and the thread prints a message to say why.

The property jmeter.exit.check.pause can be used to override the default pause of 2000ms (2secs). If set to 0, then JMeter does not start the daemon thread.

 

 

 

 

No comments:

Post a Comment