📄 get-started.html
字号:
To run the test from the client in non-GUI mode, use the following command:
</p>
<pre>
jmeter -n -t testplan.jmx -r [-Gprop=val] [-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.
</pre>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="override"><strong>2.4.5 Overriding Properties Via The Command Line</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
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:
</p>
<p>
-D[prop_name]=[value] - defines a java system property value.
</p>
<p>
-J[prop name]=[value] - defines a local JMeter property.
</p>
<p>
-G[prop name]=[value] - defines a JMeter property to be sent to all remote servers.
</p>
<p>
-L[category]=[priority] - overrides a logging setting, setting a particular category to the given priority level.
</p>
<p>
The -L flag can also be used without the category name to set the root logging level.
</p>
<p>
<b>
Examples
</b>
:
<pre>
jmeter -Duser.dir=/home/mstover/jmeter_stuff \
-Jremote_hosts=127.0.0.1 -Ljmeter.engine=DEBUG
jmeter -LDEBUG
</pre>
</p>
<p>
<b>
N.B.
<br>
</br>
The command line properties are processed early in startup, but after the logging system has been set up.
Attempts to use the -J flag to update log_level or log_file properties will have no effect.
</b>
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="logging"><strong>2.4.6 Logging and error messages</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
JMeter does not generally use pop-up dialog boxes for errors, as these would interfere with
running tests. Nor does it report any error for a mis-spelt variable or function; instead the
reference is just used as is. See
<a href="functions.html">
Functions and Variables for more information
</a>
.
</td></tr>
</table></p>
<p>
If JMeter detects an error during a test, a message will be written to the log file.
The log file name is defined in the jmeter.properties file (or using the -j option, see below).
It defaults to
<b>
jmeter.log
</b>
, and will be found in the directory from which JMeter was launched.
[in JMeter 2.2 and earlier, this was forced to be the JMeter bin directory.]
</p>
<p>
JMeter versions after 2.2 added a new command-line option, -j jmeterlogfile.
This is processed after the initial properties file is read,
and before any further properties are processed.
It therefore allows the default of jmeter.log to be overridden.
The jmeter scripts that take a test plan name as a parameter (e.g. jmeter-n.cmd) have been updated
to define the log file using the test plan name,
e.g. for the test plan Test27.jmx the log file is set to Test27.log.
</p>
<p>
When running on Windows, the file may appear as just
<b>
jmeter
</b>
unless you have set Windows to show file extensions.
[Which you should do anyway, to make it easier to detect viruses and other nasties that pretend to be text files...]
</p>
<p>
As well as recording errors, the jmeter.log file records some information about the test run. For example:
</p>
<div overflow="scroll">
<pre>
10/17/2003 12:19:20 PM INFO - jmeter.JMeter: Version 1.9.20031002
10/17/2003 12:19:45 PM INFO - jmeter.gui.action.Load: Loading file: c:\mytestfiles\BSH.jmx
10/17/2003 12:19:52 PM INFO - jmeter.engine.StandardJMeterEngine: Running the test!
10/17/2003 12:19:52 PM INFO - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group BSH. Ramp up = 1.
10/17/2003 12:19:52 PM INFO - jmeter.engine.StandardJMeterEngine: Continue on error
10/17/2003 12:19:52 PM INFO - jmeter.threads.JMeterThread: Thread BSH1-1 started
10/17/2003 12:19:52 PM INFO - jmeter.threads.JMeterThread: Thread BSH1-1 is done
10/17/2003 12:19:52 PM INFO - jmeter.engine.StandardJMeterEngine: Test has ended
</pre>
</div>
<p>
The log file can be helpful in determining the cause of an error,
as JMeter does not interrupt a test to display an error dialogue.
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="options"><strong>2.4.7 Full list of command-line options</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
Invoking JMeter as "jmeter -?" will print a list of all the command-line options.
These are shown below.
</p>
<pre>
-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)
</pre>
<p>
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'
</p>
<p>
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.
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
</blockquote>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="configuring_jmeter"><strong>2.5 Configuring JMeter</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
If you wish to modify the properties with which JMeter runs you need to
either modify the jmeter.properties in the /bin directory or create
your own copy of the jmeter.properties and specify it in the command line.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
Note: since 2.2, you can define additional JMeter properties in the file defined by the
JMeter property
<b>
user.properties
</b>
which has the default value
<b>
user.properties
</b>
.
The file will be automatically loaded if it is found in the current directory
or if it is found in the JMeter bin directory.
Similarly,
<b>
system.properties
</b>
is used to update system properties.
</td></tr>
</table></p>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>ssl.provider</td>
<td>You can specify the class for your SSL
implementation if you don't want to use the built-in Java implementation.
</td>
<td>
No
</td>
</tr>
<tr>
<td>xml.parser</td>
<td>You can specify an implementation as your XML
parser. The default value is: org.apache.xerces.parsers.SAXParser
</td>
<td>
No
</td>
</tr>
<tr>
<td>remote_hosts</td>
<td>Comma-delimited list of remote JMeter hosts (or host:port if required).
If you are running JMeter in a distributed environment, list the machines where
you have JMeter remote servers running. This will allow you to control those
servers from this machine's GUI
</td>
<td>
No
</td>
</tr>
<tr>
<td>not_in_menu</td>
<td>A list of components you do not want to see in
JMeter's menus. As JMeter has more and more components added, you may wish to
customize your JMeter to show only those components you are interested in.
You may list their classname or their class label (the string that appears
in JMeter's UI) here, and they will no longer appear in the menus.
</td>
<td>
No
</td>
</tr>
<tr>
<td>search_paths</td>
<td>
List of paths (separated by ;) that JMeter will search for JMeter add-on classes;
for example additional samplers.
This is in addition to any jars found in the lib/ext directory.
</td>
<td>
No
</td>
</tr>
<tr>
<td>user.classpath</td>
<td>
List of paths that JMeter will search for utility classes.
This is in addition to any jars found in the lib directory.
</td>
<td>
No
</td>
</tr>
<tr>
<td>user.properties</td>
<td>
Name of file containing additional JMeter properties.
These are added after the initial property file, but before the -q and -J options are processed.
</td>
<td>
No
</td>
</tr>
<tr>
<td>system.properties</td>
<td>
Name of file containing additional system properties.
These are added before the -S and -D options are processed.
</td>
<td>
No
</td>
</tr>
</table>
</p>
<p>
<b>
See also the comments in the jmeter.properties, user.properties and system.properties files for further information on other settings you can change.
</b>
</p>
</blockquote>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<br>
<table>
<tr>
<td bgcolor="#525D76">
<div align="right"><a href="index.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Index</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="build-test-plan.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Next</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="intro.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Prev</font></a></div>
</td>
</tr>
</table>
</td>
</tr>
<tr><td>
<hr noshade size="1">
</td></tr>
<tr>
<td>
<table width=100%>
<tr>
<td>
<font color="#525D76" size="-1"><em>
Copyright © 1999-2008, Apache Software Foundation
</em></font>
</td>
<td align="right">
<font color="#525D76" size="-1"><em>
Updated: $Date: 2008-05-08 17:13:16 +0100 (Thu, 08 May 2008) $
</em></font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -