mirror of https://github.com/apache/jmeter.git
505 lines
15 KiB
HTML
505 lines
15 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
this work for additional information regarding copyright ownership.
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
(the "License"); you may not use this file except in compliance with
|
|
the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
|
|
<!-- Content Stylesheet for Site -->
|
|
|
|
|
|
<!-- start the processing -->
|
|
<!-- ====================================================================== -->
|
|
<!-- Main Page Section -->
|
|
<!-- ====================================================================== -->
|
|
<html>
|
|
<head>
|
|
<link rel="stylesheet" type="text/css" href="../css/style.css"/>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
|
|
|
|
|
|
|
|
<title>Apache JMeter - User's Manual: Building a Test Plan</title>
|
|
</head>
|
|
|
|
<body bgcolor="#ffffff" text="#000000" link="#525D76">
|
|
<table border="0" cellspacing="0">
|
|
<!-- TOP IMAGE -->
|
|
<tr>
|
|
<td>
|
|
<!-- Need to specify height otherwise iframe seems to grab extra -->
|
|
<iframe src="http://www.apache.org/ads/halfbanner.html" height="102"
|
|
style="border-width:0; float: left" frameborder="0" scrolling="no"></iframe>
|
|
</td>
|
|
<td align="left">
|
|
<a href="http://www.apache.org"><img title="Apache Software Foundation" width="387" height="100" src="../images/asf-logo.gif" border="0"/></a>
|
|
</td>
|
|
<td align="right">
|
|
<a href="http://jmeter.apache.org/"><img width="221" height="102" src="../images/logo.jpg" alt="Apache JMeter" title="Apache JMeter" border="0"/></a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table border="0" width="100%" cellspacing="4">
|
|
<tr><td colspan="2">
|
|
<hr noshade size="1"/>
|
|
</td></tr>
|
|
<tr>
|
|
<!-- LEFT SIDE NAVIGATION -->
|
|
<td width="20%" valign="top" nowrap="true">
|
|
<p><strong>About</strong></p>
|
|
<ul>
|
|
<li><a href="../index.html">Overview</a>
|
|
</li>
|
|
<li><a href="../changes.html">Changes</a>
|
|
</li>
|
|
<li><a href="http://projects.apache.org/feeds/rss/jmeter.xml">Subscribe to What's New</a>
|
|
</li>
|
|
<li><a href="../issues.html">Issues</a>
|
|
</li>
|
|
<li><a href="http://www.apache.org/licenses/">License</a>
|
|
</li>
|
|
<li><a href="http://wiki.apache.org/jmeter/JMeterCommitters">Contributors</a>
|
|
</li>
|
|
</ul>
|
|
<p><strong>Download</strong></p>
|
|
<ul>
|
|
<li><a href="../download_jmeter.cgi">Download Releases</a>
|
|
</li>
|
|
<li><a href="../nightly.html">Developer (Nightly) Builds</a>
|
|
</li>
|
|
</ul>
|
|
<p><strong>Documentation</strong></p>
|
|
<ul>
|
|
<li><a href="../usermanual/index.html">User Manual</a>
|
|
</li>
|
|
<li><a href="../usermanual/component_reference.html">Component Reference</a>
|
|
</li>
|
|
<li><a href="../usermanual/functions.html">Functions Reference</a>
|
|
</li>
|
|
<li><a href="../api/index.html">Javadocs</a>
|
|
</li>
|
|
<li><a href="../localising/index.html">Localisation (Translator's Guide)</a>
|
|
</li>
|
|
<li><a href="../building.html">Building JMeter and Add-Ons</a>
|
|
</li>
|
|
<li><a href="http://wiki.apache.org/jmeter">JMeter Wiki</a>
|
|
</li>
|
|
<li><a href="http://wiki.apache.org/jmeter/JMeterFAQ">FAQ (Wiki)</a>
|
|
</li>
|
|
</ul>
|
|
<p><strong>Tutorials (PDF format)</strong></p>
|
|
<ul>
|
|
<li><a href="../usermanual/jmeter_distributed_testing_step_by_step.pdf">Distributed Testing</a>
|
|
</li>
|
|
<li><a href="../usermanual/jmeter_proxy_step_by_step.pdf">Recording Tests</a>
|
|
</li>
|
|
<li><a href="../usermanual/junitsampler_tutorial.pdf">JUnit Sampler</a>
|
|
</li>
|
|
<li><a href="../usermanual/jmeter_accesslog_sampler_step_by_step.pdf">Access Log Sampler</a>
|
|
</li>
|
|
<li><a href="../extending/jmeter_tutorial.pdf">Extending JMeter</a>
|
|
</li>
|
|
</ul>
|
|
<p><strong>Community</strong></p>
|
|
<ul>
|
|
<li><a href="http://www.apache.org/foundation/getinvolved.html">Get Involved</a>
|
|
</li>
|
|
<li><a href="../mail.html">Mailing Lists</a>
|
|
</li>
|
|
<li><a href="../svnindex.html">SVN Repositories</a>
|
|
</li>
|
|
</ul>
|
|
<p><strong>Foundation</strong></p>
|
|
<ul>
|
|
<li><a href="http://www.apache.org/">ASF</a>
|
|
</li>
|
|
<li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a>
|
|
</li>
|
|
<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a>
|
|
</li>
|
|
</ul>
|
|
</td>
|
|
<td width="80%" align="left" valign="top">
|
|
<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="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="get-started.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Prev</font></a></div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
|
<tr><td bgcolor="#525D76">
|
|
<font color="#ffffff" face="arial,helvetica,sanserif">
|
|
<strong>3. Building a Test Plan</strong></font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p>
|
|
A test plan describes a series of steps JMeter will execute when run. A complete
|
|
test plan will consist of one or more Thread Groups, logic conrollers, sample generating
|
|
controllers, listeners, timers, assertions, and configuration elements.
|
|
|
|
</p>
|
|
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
|
<tr><td bgcolor="#828DA6">
|
|
<font color="#ffffff" face="arial,helvetica,sanserif">
|
|
<a name="add_remove"><strong>3.1 Adding and Removing Elements</strong></a>
|
|
<a class="sectionlink" href="#add_remove" title="Link to here">¶</a></font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p>
|
|
Adding
|
|
<a href="test_plan.html">
|
|
elements to a test plan
|
|
</a>
|
|
can be done by right-clicking on an element in the
|
|
tree, and choosing a new element from the "add" list. Alternatively, elements can
|
|
be loaded from file and added by choosing the "merge" or "open" option.
|
|
</p>
|
|
<p>
|
|
To remove an element, make sure the element is selected, right-click on the element,
|
|
and choose the "remove" option.
|
|
</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="load_save"><strong>3.2 Loading and Saving Elements</strong></a>
|
|
<a class="sectionlink" href="#load_save" title="Link to here">¶</a></font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p>
|
|
To load an element from file, right click on the existing tree element to which
|
|
you want to add the loaded element, and select the "merge" option. Choose the file where
|
|
your elements are saved. JMeter will merge the elements into the tree.
|
|
</p>
|
|
<p>
|
|
To save tree elements, right click on an element and choose the "Save Selection As ..." option.
|
|
JMeter will save the element selected, plus all child elements beneath it. In this way,
|
|
you can save test tree fragments and individual elements for later use.
|
|
</p>
|
|
<p>
|
|
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
|
|
<tr><td>The workbench is not automatically saved with the test plan, but it can be saved separately as above.
|
|
</td></tr>
|
|
</table>
|
|
</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="config_element"><strong>3.3 Configuring Tree Elements</strong></a>
|
|
<a class="sectionlink" href="#config_element" title="Link to here">¶</a></font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p>
|
|
Any element in the test tree will present controls in JMeter's right-hand frame. These
|
|
controls allow you to configure the behavior of that particular test element. What can be
|
|
configured for an element depends on what type of element it is.
|
|
</p>
|
|
<p>
|
|
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
|
|
<tr><td>The Test Tree itself can be manipulated by dragging and dropping components around the test tree.
|
|
</td></tr>
|
|
</table>
|
|
</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="saving"><strong>3.4 Saving the Test Plan</strong></a>
|
|
<a class="sectionlink" href="#saving" title="Link to here">¶</a></font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p>
|
|
Although it is not required, we recommend that you save the Test Plan to a
|
|
file before running it. To save the Test Plan, select "Save" or "Save Test Plan As ..." from the
|
|
File menu (with the latest release, it is no longer necessary to select the
|
|
Test Plan element first).
|
|
</p>
|
|
<p>
|
|
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
|
|
<tr><td>JMeter allows you to save the entire Test Plan tree or
|
|
only a portion of it. To save only the elements located in a particular "branch"
|
|
of the Test Plan tree, select the Test Plan element in the tree from which to start
|
|
the "branch", and then click your right mouse button to access the "Save Selection As ..." menu item.
|
|
Alternatively, select the appropriate Test Plan element and then select "Save Selection As ..." from
|
|
the Edit menu.
|
|
|
|
</td></tr>
|
|
</table>
|
|
</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="run"><strong>3.5 Running a Test Plan</strong></a>
|
|
<a class="sectionlink" href="#run" title="Link to here">¶</a></font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p>
|
|
To run your test plan, choose "Start" (Control + r) from the "Run" menu item.
|
|
When JMeter is running, it shows a small green box at the right hand end of the section just under the menu bar.
|
|
You can also check the "Run" menu.
|
|
If "Start" is disabled, and "Stop" is enabled,
|
|
then JMeter is running your test plan (or, at least, it thinks it is).
|
|
</p>
|
|
<p>
|
|
|
|
The numbers to the left of the green box are the number of active threads / total number of threads.
|
|
These only apply to a locally run test; they do not include any threads started on remote systems when using client-server mode.
|
|
|
|
</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="stop"><strong>3.6 Stopping a Test</strong></a>
|
|
<a class="sectionlink" href="#stop" title="Link to here">¶</a></font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p>
|
|
|
|
There are two types of stop command available from the menu:
|
|
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
Stop (Control + '.') - stops the threads immediately if possible.
|
|
In Versions of JMeter after 2.3.2, many samplers are now Interruptible which means that active samples can be terminated early.
|
|
The stop command will check that all threads have stopped within the default timeout, which is 5000 ms = 5 seconds.
|
|
[This can be changed using the JMeter property
|
|
<code>
|
|
jmeterengine.threadstop.wait
|
|
</code>
|
|
]
|
|
If the threads have not stopped, then a message is displayed.
|
|
The Stop command can be retried, but if it fails, then it is necessary to exit JMeter to clean up.
|
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
Shutdown (Control + ',')- requests the threads to stop at the end of any current work.
|
|
Will not interrupt any active samples.
|
|
The modal shutdown dialog box will remain active until all threads have stopped.
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
Versions of JMeter after 2.3.2 allow a Stop to be initiated if Shutdown is taking too long.
|
|
Close the Shutdown dialog box and select Run/Stop, or just press Control + '.'.
|
|
|
|
</p>
|
|
<p>
|
|
|
|
When running JMeter in non-GUI mode, there is no Menu, and JMeter does not react to keystrokes such as Control + '.'.
|
|
So in versions after 2.3.2, JMeter non-GUI mode will listen for commands on a specific port
|
|
(default 4445, see the JMeter property
|
|
<code>
|
|
jmeterengine.nongui.port
|
|
</code>
|
|
).
|
|
In versions after 2.4, JMeter supports automatic choice of an alternate port if the default port is being used
|
|
(for example by another JMeter instance). In this case, JMeter will try the next higher port, continuing until
|
|
it reaches the JMeter property
|
|
<code>
|
|
jmeterengine.nongui.maxport
|
|
</code>
|
|
) which defaults to 4455.
|
|
If
|
|
<code>
|
|
maxport
|
|
</code>
|
|
is less than or equal to
|
|
<code>
|
|
port
|
|
</code>
|
|
, port scanning will not take place.
|
|
Note that JMeter 2.4 and earlier did not set up the listener for non-GUI clients, only non-GUI standalone tests;
|
|
this has been fixed.
|
|
|
|
<br>
|
|
|
|
|
|
The chosen port is displayed in the console window.
|
|
|
|
<br>
|
|
|
|
|
|
The commands currently supported are:
|
|
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
Shutdown - graceful shutdown
|
|
</li>
|
|
|
|
|
|
<li>
|
|
StopTestNow - immediate shutdown
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
These commands can be sent by using the
|
|
<code>
|
|
shutdown[.cmd|.sh]
|
|
</code>
|
|
or
|
|
<code>
|
|
stoptest[.cmd|.sh]
|
|
</code>
|
|
script
|
|
respectively. The scripts are to be found in the JMeter
|
|
<code>
|
|
bin
|
|
</code>
|
|
directory.
|
|
The commands will only be accepted if the script is run from the same host.
|
|
|
|
</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="error_reporting"><strong>3.7 Error reporting</strong></a>
|
|
<a class="sectionlink" href="#error_reporting" title="Link to here">¶</a></font>
|
|
</td></tr>
|
|
<tr><td>
|
|
<blockquote>
|
|
<p>
|
|
|
|
JMeter reports warnings and errors to the jmeter.log file, as well as some information on the test run itself.
|
|
Just occasionally there may be some errors that JMeter is unable to trap and log; these will appear on the command console.
|
|
If a test is not behaving as you expect, please check the log file in case any errors have been reported (e.g. perhaps a syntax error in a function call).
|
|
|
|
</p>
|
|
<p>
|
|
|
|
Sampling errors (e.g. HTTP 404 - file not found) are not normally reported in the log file.
|
|
Instead these are stored as attributes of the sample result.
|
|
The status of a sample result can be seen in the various different Listeners.
|
|
|
|
</p>
|
|
</blockquote>
|
|
</td></tr>
|
|
<tr><td><br></td></tr>
|
|
</table>
|
|
</blockquote>
|
|
</p>
|
|
</td></tr>
|
|
<tr><td><br></td></tr>
|
|
</table>
|
|
<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="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="get-started.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Prev</font></a></div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
<tr><td colspan="2">
|
|
<hr noshade size="1"/>
|
|
</td></tr>
|
|
<tr><td colspan="2">
|
|
<div align="center"><font color="#525D76" size="-1"><em>
|
|
Copyright © 1999-2012, Apache Software Foundation
|
|
</em></font></div>
|
|
</td></tr>
|
|
<tr><td colspan="2">
|
|
<div align="center"><font color="#525D76" size="-1">
|
|
Apache, Apache JMeter, JMeter, the Apache feather, and the Apache JMeter logo are
|
|
trademarks of the Apache Software Foundation.
|
|
</font>
|
|
</div>
|
|
</td></tr>
|
|
</table>
|
|
</body>
|
|
</html>
|
|
<!-- end the processing -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|