⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_plan.html

📁 测试工具jmeter可用来进行性能测试
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<p>

Listeners can be added anywhere in the test, including directly under the test plan.
They will collect data only from elements at or below their level.

</p>
<p>
There are several 
<a href="component_reference.html#listeners">
listeners
</a>

that come with JMeter.
</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="timers"><strong>4.4 Timers</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
By default, a JMeter thread sends requests without pausing between each request.
We recommend that you specify a delay by adding one of the available timers to
your Thread Group. If you do not add a delay, JMeter could overwhelm your server by
making too many requests in a very short amount of time.
</p>
<p>
The timer will cause JMeter to delay a certain amount of time 
<b>
before
</b>
 each
request that a thread makes.
</p>
<p>

If you choose to add more than one timer to a Thread Group, JMeter takes the sum of
the timers and pauses for that amount of time before executing the samplers to which the timers apply.
Timers can be added as children of samplers or controllers in order to restrict the samplers to which they are applied.

</p>
<p>

To provide a pause at a single place in a test plan, one can use the 
<a href="../usermanual/component_reference.html#Test_Action">Test Action</a>
 Sampler.

</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="assertions"><strong>4.5 Assertions</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
Assertions allow you to assert facts about responses received from the
server being tested. Using an assertion, you can essentially "test" that your
application is returning the results you expect it to. 
</p>
<p>
For instance, you can assert that the response to a query will contain some
particular text. The text you specify can be a Perl-style regular expression, and
you can indicate that the response is to contain the text, or that it should match
the whole response.
</p>
<p>
You can add an assertion to any Sampler. For example, you can
add an assertion to a HTTP Request that checks for the text, "&lt;/HTML&gt;".  JMeter
will then check that the text is present in the HTTP response.  If JMeter cannot find the
text, then it will mark this as a failed request.
</p>
<p>
To view the assertion results, add an Assertion Listener to the Thread Group.
Failed Assertions will also show up in the Tree View and Table Listeners, 
and will count towards the error %age for example in the Aggregate and Summary reports.

</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_elements"><strong>4.6 Configuration Elements</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
A configuration element works closely with a Sampler.  Although it does not send requests
(except for 
<a href="../usermanual/component_reference.html#HTTP_Proxy_Server">HTTP Proxy Server</a>
), it can add to or modify requests.
</p>
<p>
A configuration element is accessible from only inside the tree branch where you place the element.
For example, if you place an HTTP Cookie Manager inside a Simple Logic Controller, the Cookie Manager will
only be accessible to HTTP Request Controllers you place inside the Simple Logic Controller (see figure 1).
The Cookie Manager is accessible to the HTTP requests "Web Page 1" and "Web Page 2", but not "Web Page 3".  
</p>
<p>
Also, a configuration element inside a tree branch has higher precedence than the same element in a "parent"
branch.  For example, we defined two HTTP Request Defaults elements, "Web Defaults 1" and "Web Defaults 2".
Since we placed "Web Defaults 1" inside a Loop Controller, only "Web Page 2" can access it.  The other HTTP
requests will use "Web Defaults 2", since we placed it in the Thread Group (the "parent" of all other branches).
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img  src="../../docs/images/screenshots/http-config/http-config-example.png"><br>
<font size="-1">Figure 1 -
	Test Plan Showing Accessability of Configuration Elements
</font></td></tr></table></p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
The 
<a href="../usermanual/component_reference.html#User_Defined_Variables">User Defined Variables</a>
 Configuration element is different. 
It is processed at the start of a test, no matter where it is placed.
For simplicity, it is suggested that the element is placed only at the start of a Thread Group.

</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="preprocessors"><strong>4.7 Pre-Processor Elements</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
A Pre-Processor executes some action prior to a Sampler Request being made. 
If a Pre-Processor is attached to a Sampler element, then it will execute just prior to that sampler element running. 
A Pre-Processor is most often used to modify the settings of a Sample Request just before it runs, or to update variables that aren't extracted from response text.  
See the 
<a href="build-test-plan.html#scoping_rules">
<b>
scoping rules
</b>
</a>
 for more details on when Pre-Processors are executed.
</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="postprocessors"><strong>4.8 Post-Processor Elements</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
A Post-Processor executes some action after a Sampler Request has been made.
If a Post-Processor is attached to a Sampler element, then it will execute just after that sampler element runs.
A Post-Processor is most often used to process the response data, often to extract values from it.  
See the 
<a href="build-test-plan.html#scoping_rules">
<b>
scoping rules
</b>
</a>
 for more details on when Post-Processors are executed.
</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="executionorder"><strong>4.9 Execution order</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<ol start="0">


<li>
Configuration elements
</li>


<li>
Pre-Processors
</li>


<li>
Timers
</li>


<li>
Sampler
</li>


<li>
Post-Processors (unless SampleResult is null)
</li>


<li>
Assertions (unless SampleResult is null)
</li>


<li>
Listeners (unless SampleResult is null)
</li>


</ol>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
Please note that Timers, Assertions, Pre- and Post-Processors are only processed if there is a sampler to which they apply.
Logic Controllers and Samplers are processed in the order in which they appear in the tree. 
Other test elements are processed according to the scope in which they are found, and the type of test element.
[Within a type, elements are processed in the order in which they appear in the tree].

</td></tr>
</table></p>
<p>

For example, in the following test plan:

<ul>


<li>
Controller
</li>


<ul>


<li>
Post-Processor 1
</li>


<li>
Sampler 1
</li>


<li>
Sampler 2
</li>


<li>
Timer 1
</li>


<li>
Assertion 1
</li>


<li>
Pre-Processor 1
</li>


<li>
Timer 2
</li>


<li>
Post-Processor 2
</li>


</ul>


</ul>

The order of execution would be:

<pre>

Pre-Processor 1
Timer 1
Timer 2
Sampler 1
Post-Processor 1
Post-Processor 2
Assertion 1

Pre-Processor 1
Timer 1
Timer 2
Sampler 2
Post-Processor 1
Post-Processor 2
Assertion 1

</pre>


</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="properties"><strong>4.10 Properties and Variables</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>

JMeter 
<b>
properties
</b>
 are defined in jmeter.properties (see 
<a href="get-started.html#configuring_jmeter">
Gettting Started - Configuring JMeter
</a>
 for more details).

<br>
</br>

Properties are global to jmeter, and are mostly used to define some of the defaults JMeter uses.
For example the property remote_hosts defines the servers that JMeter will try to run remotely.
Properties can be referenced in test plans 
- see 
<a href="functions.html#__property">
Functions - read a property
</a>
 -
but cannot be used for thread-specific values.

</p>
<p>

JMeter 
<b>
variables
</b>
 are local to each thread. The values may be the same for each thread, or they may be different.

<br>
</br>

If a variable is updated by a thread, only the thread copy of the variable is changed.
For example the 
<a href="../usermanual/component_reference.html#Regular_Expression_Extractor">Regular Expression Extractor</a>
 Post-Processor 
will set its variables according to the sample that its thread has read, and these can be used later
by the same thread.
For details of how to reference variables and functions, see 
<a href="functions.html">
Functions and Variables
</a>


</p>
<p>

Note that the values defined by the 
<a href="../usermanual/component_reference.html#Test_Plan">Test Plan</a>
  and the 
<a href="../usermanual/component_reference.html#User_Defined_Variables">User Defined Variables</a>
 configuration element
are made available to the whole test plan at startup. 
If the same variable is defined by multiple elements, then the last one takes effect.

Other elements such as the 

<a href="../usermanual/component_reference.html#User_Parameters">User Parameters</a>
 Pre-Processor or 
<a href="../usermanual/component_reference.html#Regular_Expression_Extractor">Regular Expression Extractor</a>
 Post-Processor
may be used to redefine the same variables. These redefinitions only apply to the current thread.

</p>
<p>

Note that global variables cannot be updated during a test.
The 
<a href="functions.html#__setProperty">
setProperty
</a>
 function can be used to define a JMeter property.
These are global to the test plan, so can be used to pass information between threads.

</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
</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-web-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="build-test-plan.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 &copy; 1999-2008, Apache Software Foundation
</em></font>
</td>
<td align="right">
<font color="#525D76" size="-1"><em>
Updated: $Date: 2008-05-12 23:26:26 +0100 (Mon, 12 May 2008) $
</em></font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>




























⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -