|
JMeter example source code file (build-test-plan.xml)
The JMeter build-test-plan.xml source code
<?xml version="1.0"?>
<!--
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.
-->
<!DOCTYPE document[
<!ENTITY sect-num '3'>
]>
<document prev="get-started.html" next="test_plan.html" date="$Date: 2010-07-08 12:16:09 +0100 (Thu, 08 Jul 2010) $">
<properties>
<title>User's Manual: Building a Test Plan
</properties>
<body>
<section name="§-num;. Building a Test Plan">
<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>
<subsection name="§-num;.1 Adding and Removing Elements" anchor="add_remove">
<p>Adding elements to a test plan 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>
</subsection>
<subsection name="§-num;.2 Loading and Saving Elements" anchor="load_save">
<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>
<note>The workbench is not automatically saved with the test plan, but it can be saved separately as above.
</subsection>
<subsection name="§-num;.3 Configuring Tree Elements" anchor="config_element">
<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>
<note>The Test Tree itself can be manipulated by dragging and dropping components around the test tree.
</subsection>
<subsection name="§-num;.4 Saving the Test Plan" anchor="saving">
<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>
<note>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.
</note>
</subsection>
<subsection name="§-num;.5 Running a Test Plan" anchor="run">
<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>
</subsection>
<subsection name="§-num;.6 Stopping a Test" anchor="stop">
<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]
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).
The commands currently supported are:
<ul>
<li>Shutdown - graceful shutdown
<li>StopTestNow - immediate shutdown
</ul>
These commands can be sent by using the <code>shutdown[.cmd|.sh] or
Other JMeter examples (source code examples)Here is a short list of links related to this JMeter build-test-plan.xml source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.