jmeter/docs/usermanual/component_reference.html

12149 lines
357 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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>JMeter - User's Manual: Component Reference</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://jakarta.apache.org"><img width="505" height="48" src="../images/jakarta-logo.gif" alt="Jakarta" title="Jakarta" border="0"/></a>
</td>
<td align="right">
<a href="http://jakarta.apache.org/jmeter/"><img width="221" height="102" src="../images/logo.jpg" alt="JMeter" title="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="../known_bugs.html">Known Bugs</a>
</li>
<li> <a href="../license.html">License</a>
</li>
<li> <a href="http://wiki.apache.org/jakarta-jmeter/JMeterCommitters">Contributors</a>
</li>
</ul>
<p><strong>Download</strong></p>
<ul>
<li> <a href="http://jakarta.apache.org/site/downloads/downloads_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="../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/jakarta-jmeter">JMeter Wiki</a>
</li>
<li> <a href="http://wiki.apache.org/jakarta-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://jakarta.apache.org/site/getinvolved.html">Get Involved</a>
</li>
<li> <a href="http://jakarta.apache.org/site/mail.html">Mailing Lists</a>
</li>
<li> <a href="http://jakarta.apache.org/site/cvsindex.html">SVN Repositories</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="functions.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Next</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="boss.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Prev</font></a></div>
</td>
</tr>
</table>
<br>
<ul>
<li><a href="#samplers">18.1 Samplers</a></li>
<ul>
<li><a href="#FTP_Request">FTP Request</a></li>
<li><a href="#HTTP_Request">HTTP Request</a></li>
<li><a href="#JDBC_Request">JDBC Request</a></li>
<li><a href="#Java_Request">Java Request</a></li>
<li><a href="#SOAP/XML-RPC_Request">SOAP/XML-RPC Request</a></li>
<li><a href="#WebService(SOAP)_Request">WebService(SOAP) Request</a></li>
<li><a href="#LDAP_Request">LDAP Request</a></li>
<li><a href="#LDAP_Extended_Request">LDAP Extended Request</a></li>
<li><a href="#Access_Log_Sampler">Access Log Sampler</a></li>
<li><a href="#BeanShell_Sampler">BeanShell Sampler</a></li>
<li><a href="#BSF_Sampler">BSF Sampler</a></li>
<li><a href="#TCP_Sampler">TCP Sampler</a></li>
<li><a href="#JMS_Publisher">JMS Publisher</a></li>
<li><a href="#JMS_Subscriber">JMS Subscriber</a></li>
<li><a href="#JMS_Point-to-Point">JMS Point-to-Point</a></li>
<li><a href="#JUnit_Request">JUnit Request</a></li>
<li><a href="#Mail_Reader_Sampler">Mail Reader Sampler</a></li>
<li><a href="#Test_Action">Test Action</a></li>
</ul>
<li><a href="#logic_controllers">18.2 Logic Controllers</a></li>
<ul>
<li><a href="#Simple_Controller">Simple Controller</a></li>
<li><a href="#Loop_Controller">Loop Controller</a></li>
<li><a href="#Once_Only_Controller">Once Only Controller</a></li>
<li><a href="#Interleave_Controller">Interleave Controller</a></li>
<li><a href="#Random_Controller">Random Controller</a></li>
<li><a href="#Random_Order_Controller">Random Order Controller</a></li>
<li><a href="#Throughput_Controller">Throughput Controller</a></li>
<li><a href="#Runtime_Controller">Runtime Controller</a></li>
<li><a href="#If_Controller">If Controller</a></li>
<li><a href="#While_Controller">While Controller</a></li>
<li><a href="#Switch_Controller">Switch Controller</a></li>
<li><a href="#ForEach_Controller">ForEach Controller</a></li>
<li><a href="#Module_Controller">Module Controller</a></li>
<li><a href="#Include_Controller">Include Controller</a></li>
<li><a href="#Transaction_Controller">Transaction Controller</a></li>
<li><a href="#Recording_Controller">Recording Controller</a></li>
</ul>
<li><a href="#listeners">18.3 Listeners</a></li>
<ul>
<li><a href="#Sample_Result_Save_Configuration">Sample Result Save Configuration</a></li>
<li><a href="#Graph_Full_Results">Graph Full Results</a></li>
<li><a href="#Graph_Results">Graph Results</a></li>
<li><a href="#Spline_Visualizer">Spline Visualizer</a></li>
<li><a href="#Assertion_Results">Assertion Results</a></li>
<li><a href="#View_Results_Tree">View Results Tree</a></li>
<li><a href="#Aggregate_Report">Aggregate Report</a></li>
<li><a href="#View_Results_in_Table">View Results in Table</a></li>
<li><a href="#Simple_Data_Writer">Simple Data Writer</a></li>
<li><a href="#Monitor_Results">Monitor Results</a></li>
<li><a href="#Distribution_Graph_(alpha)">Distribution Graph (alpha)</a></li>
<li><a href="#Aggregate_Graph">Aggregate Graph</a></li>
<li><a href="#Mailer_Visualizer">Mailer Visualizer</a></li>
<li><a href="#BeanShell_Listener">BeanShell Listener</a></li>
<li><a href="#Summary_Report">Summary Report</a></li>
</ul>
<li><a href="#config_elements">18.4 Configuration Elements</a></li>
<ul>
<li><a href="#CSV_Data_Set_Config">CSV Data Set Config</a></li>
<li><a href="#FTP_Request_Defaults">FTP Request Defaults</a></li>
<li><a href="#HTTP_Authorization_Manager">HTTP Authorization Manager</a></li>
<li><a href="#HTTP_Cookie_Manager">HTTP Cookie Manager</a></li>
<li><a href="#HTTP_Request_Defaults">HTTP Request Defaults</a></li>
<li><a href="#HTTP_Header_Manager">HTTP Header Manager</a></li>
<li><a href="#Java_Request_Defaults">Java Request Defaults</a></li>
<li><a href="#JDBC_Connection_Configuration">JDBC Connection Configuration</a></li>
<li><a href="#Login_Config_Element">Login Config Element</a></li>
<li><a href="#LDAP_Request_Defaults">LDAP Request Defaults</a></li>
<li><a href="#LDAP_Extended_Request_Defaults">LDAP Extended Request Defaults</a></li>
<li><a href="#TCP_Sampler_Config">TCP Sampler Config</a></li>
<li><a href="#User_Defined_Variables">User Defined Variables</a></li>
<li><a href="#Simple_Config_Element">Simple Config Element</a></li>
</ul>
<li><a href="#assertions">18.5 Assertions</a></li>
<ul>
<li><a href="#Response_Assertion">Response Assertion</a></li>
<li><a href="#Duration_Assertion">Duration Assertion</a></li>
<li><a href="#Size_Assertion">Size Assertion</a></li>
<li><a href="#XML_Assertion">XML Assertion</a></li>
<li><a href="#BeanShell_Assertion">BeanShell Assertion</a></li>
<li><a href="#MD5Hex_Assertion">MD5Hex Assertion</a></li>
<li><a href="#HTML_Assertion">HTML Assertion</a></li>
<li><a href="#XPath_Assertion">XPath Assertion</a></li>
<li><a href="#XML_Schema_Assertion">XML Schema Assertion</a></li>
</ul>
<li><a href="#timers">18.6 Timers</a></li>
<ul>
<li><a href="#Constant_Timer">Constant Timer</a></li>
<li><a href="#Gaussian_Random_Timer">Gaussian Random Timer</a></li>
<li><a href="#Uniform_Random_Timer">Uniform Random Timer</a></li>
<li><a href="#Constant_Throughput_Timer">Constant Throughput Timer</a></li>
<li><a href="#Synchronizing_Timer">Synchronizing Timer</a></li>
<li><a href="#BeanShell_Timer">BeanShell Timer</a></li>
</ul>
<li><a href="#preprocessors">18.7 Pre Processors</a></li>
<ul>
<li><a href="#HTML_Link_Parser">HTML Link Parser</a></li>
<li><a href="#HTTP_URL_Re-writing_Modifier">HTTP URL Re-writing Modifier</a></li>
<li><a href="#HTML_Parameter_Mask">HTML Parameter Mask</a></li>
<li><a href="#HTTP_User_Parameter_Modifier">HTTP User Parameter Modifier</a></li>
<li><a href="#User_Parameters">User Parameters</a></li>
<li><a href="#Counter">Counter</a></li>
<li><a href="#BeanShell_PreProcessor">BeanShell PreProcessor</a></li>
</ul>
<li><a href="#postprocessors">18.8 Post-Processors</a></li>
<ul>
<li><a href="#Regular_Expression_Extractor">Regular Expression Extractor</a></li>
<li><a href="#XPath_Extractor">XPath Extractor</a></li>
<li><a href="#Result_Status_Action_Handler">Result Status Action Handler</a></li>
<li><a href="#Save_Responses_to_a_file">Save Responses to a file</a></li>
<li><a href="#Generate_Summary_Results">Generate Summary Results</a></li>
<li><a href="#BeanShell_PostProcessor">BeanShell PostProcessor</a></li>
</ul>
<li><a href="#Miscellaneous_Features">18.9 Miscellaneous Features</a></li>
<ul>
<li><a href="#Test_Plan">Test Plan</a></li>
<li><a href="#Thread_Group">Thread Group</a></li>
<li><a href="#WorkBench">WorkBench</a></li>
<li><a href="#SSL_Manager">SSL Manager</a></li>
<li><a href="#HTTP_Proxy_Server">HTTP Proxy Server</a></li>
<li><a href="#HTTP_Mirror_Server">HTTP Mirror Server</a></li>
<li><a href="#Property_Display">Property Display</a></li>
<li><a href="#Debug_Sampler">Debug Sampler</a></li>
<li><a href="#Debug_PostProcessor">Debug PostProcessor</a></li>
</ul>
<li><a href="#Reports">18.10 Reports</a></li>
<ul>
<li><a href="#Report_Plan">Report Plan</a></li>
<li><a href="#Report_Table">Report Table</a></li>
<li><a href="#HTML_Report_Writer">HTML Report Writer</a></li>
<li><a href="#Report_Page">Report Page</a></li>
<li><a href="#Line_Graph">Line Graph</a></li>
<li><a href="#Bar_Chart">Bar Chart</a></li>
</ul>
</ul>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="samplers"><strong>18.1 Samplers</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<description >
<p >
Samplers perform the actual work of JMeter.
Each sampler (except Test Action) generates one or more sample results.
The sample results have various attributes (success/fail, elapsed time, data size etc) and can be viewed in the various listeners.
</p>
</description>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="FTP_Request"><h3>18.1.1 FTP Request</h3></a>
</font>
</td></tr>
<tr><td>
This controller lets you send an FTP "retrieve file" or "upload file" request to an FTP server.
If you are going to send multiple requests to the same FTP server, consider
using a
<a href="../usermanual/component_reference.html#FTP_Request_Defaults">FTP Request Defaults</a>
Configuration
Element so you do not have to enter the same information for each FTP Request Generative
Controller. When downloading a file, it can be stored on disk (Local File) or in the Response Data, or both.
<p >
Latency is set to the time it takes to login (versions of JMeter after 2.3.1).
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='502' height='299' src="../images/screenshots/ftptest/ftp-request.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Server Name or IP</td>
<td> Domain name or IP address of the FTP server.
JMeter assumes the FTP server is listening on the default port.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Remote File:</td>
<td> File to retrieve or name of destination file to upload.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Local File:</td>
<td> File to upload, or destination for downloads (defaults to remote file name).
</td>
<td>
Yes, if uploading (*)
</td>
</tr>
<tr>
<td>Local File Contents:</td>
<td> Provides the contents for the upload, overrides the Local File property.
</td>
<td>
Yes, if uploading (*)
</td>
</tr>
<tr>
<td>get(RETR) / put(STOR)</td>
<td> Whether to retrieve or upload a file.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Use Binary mode ?</td>
<td> Check this to use Binary mode (default Ascii)
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Save File in Response ?</td>
<td>
Whether to store contents of retrieved file in response data.
If the mode is Ascii, then the contents will be visible in the Tree View Listener.
</td>
<td>
Yes, if downloading
</td>
</tr>
<tr>
<td>Username</td>
<td> FTP account username.
</td>
<td>
Usually
</td>
</tr>
<tr>
<td>Password</td>
<td> FTP account password. N.B. This will be visible in the test plan.
</td>
<td>
Usually
</td>
</tr>
</table>
</p>
<p><b>See Also:</b>
<ul>
<li><a href="test_plan.html#assertions">Assertions</a></li>
<li> <a href="../usermanual/component_reference.html#FTP_Request_Defaults">FTP Request Defaults</a>
</li>
<li><a href="build-ftp-test-plan.html">Building an FTP Test Plan</a></li>
</ul>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTTP_Request"><h3>18.1.2 HTTP Request</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This sampler lets you send an HTTP/HTTPS request to a web server. It
also lets you control whether or not JMeter parses HTML files for images and
other embedded resources and sends HTTP requests to retrieve them.
The following types of embedded resource are retrieved:
</p>
<ul >
<li >
images
</li>
<li >
applets
</li>
<li >
stylesheets
</li>
<li >
external scripts
</li>
<li >
frames
</li>
<li >
background images (body, table, TD, TR)
</li>
<li >
background sound
</li>
</ul>
<p >
The default parser is htmlparser.
This can be changed by using the property "htmlparser.classname" - see jmeter.properties for details.
</p>
<p >
If you are going to send multiple requests to the same web server, consider
using an
<a href="../usermanual/component_reference.html#HTTP_Request_Defaults">HTTP Request Defaults</a>
Configuration Element so you do not have to enter the same information for each
HTTP Request.
</p>
<p >
Or, instead of manually adding HTTP Requests, you may want to use
JMeter's
<a href="../usermanual/component_reference.html#HTTP_Proxy_Server">HTTP Proxy Server</a>
to create
them. This can save you time if you have a lot of HTTP requests or requests with many
parameters.
</p>
<p >
<b >
There are two versions of the sampler:
</b>
<ul >
<li >
HTTP Request - uses the default Java HTTP implementation
</li>
<li >
HTTP Request HTTPClient - uses Apache Commons HttpClient
</li>
</ul>
</p>
<p >
The default (Java) implementation has some limitations:
</p>
<ul >
<li >
There is no control over how connections are re-used.
When a connection is released by JMeter, it may or may not be re-used by the same thread.
</li>
<li >
The API is best suited to single-threaded usage - various settings (e.g. proxy)
are defined via system properties, and therefore apply to all connections.
</li>
<li >
There is a bug in the handling of HTTPS via a Proxy (the CONNECT is not handled correctly).
See Java bugs 6226610 and 6208335.
</li>
</ul>
<p >
Note: the FILE protocol is intended for testing puposes only.
It is handled by the same code regardless of which HTTP Sampler is used.
</p>
<p >
If the request requires server or proxy login authorization (i.e. where a browser would create a pop-up dialog box),
you will also have to add an
<a href="../usermanual/component_reference.html#HTTP_Authorization_Manager">HTTP Authorization Manager</a>
Configuration Element.
For normal logins (i.e. where the user enters login information in a form), you will need to work out what the form submit button does,
and create an HTTP request with the appropriate method (usually POST)
and the appropriate parameters from the form definition.
If the page uses HTTP, you can use the JMeter Proxy to capture the login sequence.
</p>
<p >
In versions of JMeter up to 2.2, only a single SSL context was used for all threads and samplers.
This did not generate the proper load for multiple users.
A separate SSL context is now used for each thread.
To revert to the original behaviour, set the JMeter property:
<pre >
https.sessioncontext.shared=true
</pre>
</p>
<p >
JMeter defaults to the SSL protocol level TLS.
If the server needs a different level, e.g. SSLv3, change the JMeter property, for example:
<pre >
https.default.protocol=SSLv3
</pre>
</p>
<p >
If the request uses cookies, then you will also need an
<a href="../usermanual/component_reference.html#HTTP_Cookie_Manager">HTTP Cookie Manager</a>
. You can
add either of these elements to the Thread Group or the HTTP Request. If you have
more than one HTTP Request that needs authorizations or cookies, then add the
elements to the Thread Group. That way, all HTTP Request controllers will share the
same Authorization Manager and Cookie Manager elements.
</p>
<p >
If the request uses a technique called "URL Rewriting" to maintain sessions,
then see section
<a href="build-adv-web-test-plan.html#session_url_rewriting">
6.1 Handling User Sessions With URL Rewriting
</a>
for additional configuration steps.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='683' height='590' src="../images/screenshots/webtest/http-request.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Server</td>
<td> Domain name or IP address of the web server. e.g. www.example.com. [Do not include the http:// prefix.]
</td>
<td>
No
</td>
</tr>
<tr>
<td>Port</td>
<td> Port the web server is listening to. Default: 80
</td>
<td>
No
</td>
</tr>
<tr>
<td>Protocol</td>
<td> HTTP, HTTPS or FILE. Default: HTTP
</td>
<td>
No
</td>
</tr>
<tr>
<td>Method</td>
<td> GET, POST, HEAD, TRACE, OPTIONS, PUT, DELETE
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Content Encoding</td>
<td> Content encoding to be used (for POST and FILE)
</td>
<td>
No
</td>
</tr>
<tr>
<td>Redirect Automatically</td>
<td>
Sets the underlying http protocol handler to automatically follow redirects,
so they are not seen by JMeter, and thus will not appear as samples.
Should only be used for GET and HEAD requests.
The HttpClient sampler will reject attempts to use it for POST or PUT.
<b >
Warning: see below for information on cookie and header handling.
</b>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Follow Redirects</td>
<td>
This only has any effect if "Redirect Automatically" is not enabled.
If set, the JMeter sampler will check if the response is a redirect and follow it if so.
The redirect response will appear as an additional sample.
Note that the HttpClient sampler may log the following message:
<br >
</br>
"Redirect requested but followRedirects is disabled"
<br >
</br>
This can be ignored.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Use KeepAlive</td>
<td> JMeter sets the Connection: keep-alive header. This does not work properly with the default HTTP implementation, as connection re-use is not under user-control.
It does work with the Jakarta httpClient implementation.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Use multipart/form-data for HTTP POST</td>
<td>
Use a multipart/form-data or application/x-www-form-urlencoded post request
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Path</td>
<td> The path to resource (for example, /servlets/myServlet). If the
resource requires query string parameters, add them below in the
"Send Parameters With the Request" section.
<b >
As a special case, if the path starts with "http://" or "https://" then this is used as the full URL.
</b>
In this case, the server, port and protocol are ignored; parameters are also ignored for GET and DELETE methods.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Send Parameters With the Request</td>
<td> The query string will
be generated from the list of parameters you provide. Each parameter has a
<i >
name
</i>
and
<i >
value
</i>
, the options to encode the parameter, and an option to include or exclude an equals sign (some applications
don't expect an equals when the value is the empty string). The query string will be generated in the correct fashion, depending on
the choice of "Method" you made (ie if you chose GET or DELETE, the query string will be
appended to the URL, if POST or PUT, then it will be sent separately). Also, if you are
sending a file using a multipart form, the query string will be created using the
multipart form specifications.
<b >
See below for some further information on parameter handling.
</b>
<p >
Additionally, you can specify whether each parameter should be URL encoded. If you are not sure what this
means, it is probably best to select it. If your values contain characters such as &amp; or spaces, or
question marks, then encoding is usually required.
</p>
</td>
<td>
No
</td>
</tr>
<tr>
<td>Filename</td>
<td> Name of the file to send. If left blank, JMeter
does not send a file, if filled in, JMeter automatically sends the request as
a multipart form request.
<p >
If it is a POST or PUT request and the 'name' atribute (below) are omitted, then the file is sent as the entire body
of the request, i.e. no wrappers are added. This allows arbitrary bodies to be sent. This functionality is present for POST requests
after version 2.2, and also for PUT requests after version 2.3.
<b >
See below for some further information on parameter handling.
</b>
</p>
</td>
<td>
No
</td>
</tr>
<tr>
<td>Value for 'name' attribute</td>
<td> Value of the "name" web request parameter.
</td>
<td>
No
</td>
</tr>
<tr>
<td>MIME Type</td>
<td> MIME type (for example, text/plain).
If it is a POST or PUT request and either the 'name' atribute (below) are omitted or the request body is
constructed from parameter values only, then the value of this field is used as the value of the
content-type request header.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Retrieve All Embedded Resources from HTML Files</td>
<td> Tell JMeter to parse the HTML file
and send HTTP/HTTPS requests for all images, Java applets, JavaScript files, CSSs, etc. referenced in the file.
See below for more details.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Use as monitor</td>
<td> For use with the
<a href="../usermanual/component_reference.html#Monitor_Results">Monitor Results</a>
listener.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Save response as MD5 hash?</td>
<td>
If this is selected, then the response is not stored in the sample result.
Instead, the 32 character MD5 hash of the data is calculated and stored instead.
This is intended for testing large amounts of data.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Embedded URLs must match:</td>
<td>
If present, this must be a regular expression that is used to match against any embedded URLs found.
So if you only want to download embedded resources from http://example.com/, use the expression:
http://example\.com/.*
</td>
<td>
No
</td>
</tr>
</table>
</p>
<p >
<b >
N.B.
</b>
when using Automatic Redirection, cookies are only sent for the initial URL.
This can cause unexpected behaviour for web-sites that redirect to a local server.
E.g. if www.example.com redirects to www.example.co.uk.
In this case the server will probably return cookies for both URLs, but JMeter will only see the cookies for the last
host, i.e. www.example.co.uk. If the next request in the test plan uses www.example.com,
rather than www.example.co.uk, it will not get the correct cookies.
Likewise, Headers are sent for the initial request, and won't be sent for the redirect.
This is generally only a problem for manually created test plans,
as a test plan created using a recorder would continue from the redirected URL.
</p>
<p >
<b >
Parameter Handling:
</b>
<br >
</br>
For the POST and PUT method, if there is no file to send, and the name(s) of the parameter(s) are omitted,
then the body is created by concatenating all the value(s) of the parameters.
This allows arbitrary bodies to be sent.
The values are encoded if the encoding flag is set (versions of JMeter after 2.3).
See also the MIME Type above how you can control the content-type request header that is sent.
<br >
</br>
For other methods, if the name of the parameter is missing,
then the parameter is ignored. This allows the use of optional parameters defined by variables.
(versions of JMeter after 2.3)
</p>
<p >
<b >
Method Handling:
</b>
<br >
</br>
The POST and PUT request methods work similarly, except that the PUT method does not support multipart requests.
The GET and DELETE request methods work similarly.
</p>
<p >
Upto and including JMeter 2.1.1, only responses with the content-type "text/html" were scanned for
embedded resources. Other content-types were assumed to be something other than HTML.
JMeter 2.1.2 introduces the a new property
<b >
HTTPResponse.parsers
</b>
, which is a list of parser ids,
e.g.
<b >
htmlParser
</b>
and
<b >
wmlParser
</b>
. For each id found, JMeter checks two further properties:
</p>
<ul >
<li >
id.types - a list of content types
</li>
<li >
id.className - the parser to be used to extract the embedded resources
</li>
</ul>
<p >
See jmeter.properties file for the details of the settings.
If the HTTPResponse.parser property is not set, JMeter reverts to the previous behaviour,
i.e. only text/html responses will be scanned
</p>
<p><b>See Also:</b>
<ul>
<li><a href="test_plan.html#assertions">Assertion</a></li>
<li><a href="build-web-test-plan.html">Building a Web Test Plan</a></li>
<li><a href="build-adv-web-test-plan.html">Building an Advanced Web Test Plan</a></li>
<li> <a href="../usermanual/component_reference.html#HTTP_Authorization_Manager">HTTP Authorization Manager</a>
</li>
<li> <a href="../usermanual/component_reference.html#HTTP_Cookie_Manager">HTTP Cookie Manager</a>
</li>
<li> <a href="../usermanual/component_reference.html#HTTP_Header_Manager">HTTP Header Manager</a>
</li>
<li> <a href="../usermanual/component_reference.html#HTML_Link_Parser">HTML Link Parser</a>
</li>
<li> <a href="../usermanual/component_reference.html#HTTP_Proxy_Server">HTTP Proxy Server</a>
</li>
<li> <a href="../usermanual/component_reference.html#HTTP_Request_Defaults">HTTP Request Defaults</a>
</li>
<li><a href="build-adv-web-test-plan.html#session_url_rewriting">HTTP Requests and Session ID's: URL Rewriting</a></li>
</ul>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="JDBC_Request"><h3>18.1.3 JDBC Request</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This sampler lets you send an JDBC Request (an SQL query) to a database.
</p>
<p >
Before using this you need to set up a
<a href="../usermanual/component_reference.html#JDBC_Connection_Configuration">JDBC Connection Configuration</a>
Configuration element
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='449' height='335' src="../images/screenshots/jdbctest/jdbc-request.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Variable Name</td>
<td>
Name of the JMeter variable that the connection pool is bound to.
This must agree with the 'Variable Name' field of a JDBC Connection Configuration.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Query Type</td>
<td> Set this according to the statement type:
<ul >
<li >
Select Statement
</li>
<li >
Update Statement - use this for Inserts as well
</li>
<li >
Callable Statement
</li>
<li >
Prepared Select Statement
</li>
<li >
Prepared Update Statement - use this for Inserts as well
</li>
<li >
Commit
</li>
<li >
Rollback
</li>
<li >
Autocommit(false)
</li>
<li >
Autocommit(true)
</li>
<li >
Edit - this should be a variable reference that evaluates to one of the above
</li>
</ul>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>SQL Query</td>
<td>
SQL query.
Do not enter a trailing semi-colon.
There is generally no need to use { and } to enclose Callable statements;
however they mey be used if the database uses a non-standard syntax.
[The JDBC driver automatically converts the statement if necessary when it is enclosed in {}].
For example:
<ul >
<li >
select * from t_customers where id=23
</li>
<li >
CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE (null,?, ?, null, null, null)
<ul >
<li >
Parameter values: tablename,filename
</li>
<li >
Parameter types: VARCHAR,VARCHAR
</li>
</ul>
</li>
The second example assumes you are using Apache Derby.
</ul>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Parameter values</td>
<td>
Comma-separated list of parameter values. Use ]NULL[ to indicate a NULL parameter.
(If required, the null string can be changed by defining the property "jdbcsampler.nullmarker".)
<br >
</br>
There must be as many values as there are placeholders in the statement.
</td>
<td>
Yes, if a prepared or callable statement has parameters
</td>
</tr>
<tr>
<td>Parameter types</td>
<td>
Comma-separated list of SQL parameter types (e.g. INTEGER, DATE, VARCHAR, DOUBLE).
If the callable statement has INOUT or OUT parameters, then these must be indicated by prefixing the
appropriate parameter types, e.g. instead of "INTEGER", use "INOUT INTEGER".
If not specified, "IN" is assumed, i.e. "DATE" is the same as "IN DATE".
<br >
</br>
There must be as many values as there are placeholders in the statement.
</td>
<td>
Yes, if a prepared or callable statement has parameters
</td>
</tr>
</table>
</p>
<p><b>See Also:</b>
<ul>
<li><a href="build-db-test-plan.html">Building a Database Test Plan</a></li>
<li> <a href="../usermanual/component_reference.html#JDBC_Connection_Configuration">JDBC Connection Configuration</a>
</li>
</ul>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Java_Request"><h3>18.1.4 Java Request</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This sampler lets you control a java class that implements the
JavaSamplerClient interface. By writing your own implementation of this interface,
you can use JMeter to harness multiple threads, input parameter control, and
data collection.
</p>
<p >
The pull-down menu provides the list of all such implementations found by
JMeter in its classpath. The parameters can then be specified in the
table below - as defined by your implementation. Two simple examples (JavaTest and SleepTest) are provided.
</p>
<p >
The JavaTest example sampler can be useful for checking test plans, because it allows one to set
values in almost all the fields. These can then be used by Assertions, etc.
The fields allow variables to be used, so the values of these can readily be seen.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='406' height='307' src="../images/screenshots/java_request.png"></div>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> The Add/Delete buttons don't serve any purpose at present.
</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>Name</td>
<td> Descriptive name for this sampler
that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Classname</td>
<td> The specific implementation of
the JavaSamplerClient interface to be sampled.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Send Parameters with Request</td>
<td> A list of
arguments that will be passed to the sampled class. All arguments
are sent as Strings.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<p >
The sleep time is calculated as follows:
</p>
<pre >
SleepTime is in milliseconds
SleepMask is used to add a "random" element to the time:
totalSleepTime = SleepTime + (System.currentTimeMillis() % SleepMask)
</pre>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="SOAP/XML-RPC_Request"><h3>18.1.5 SOAP/XML-RPC Request</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This sampler lets you send a SOAP request to a webservice. It can also be
used to send XML-RPC over HTTP. It creates an HTTP POST request, with the specified XML as the
POST content.
To change the "Content-type" from the default of "text/html", use a HeaderManager.
Note that the sampler will use all the headers from the HeaderManager.
If a SOAP action is specified, that will override any SOAPaction in the HeaderManager.
The primary difference between the soap sampler and
webservice sampler, is the soap sampler uses raw post and does not require conformance to
XML.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> For versions of JMeter later than 2.2, the sampler no longer uses chunked encoding by default.
<br >
</br>
For screen input, it now always uses the size of the data.
<br >
</br>
File input uses the file length as determined by Java.
<br >
</br>
On some OSes this may not work for all files, in which case add a child Header Manager
with Content-Length set to the actual length of the file.
<br >
</br>
Or set Content-Length to -1 to force chunked encoding.
</td></tr>
</table></p>
<p><b>Control Panel</b></p>
<div align="center"><img width='474' height='236' src="../images/screenshots/soap_sampler.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this sampler
that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>URL</td>
<td> The URL to direct the SOAP request to.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Send SOAP action</td>
<td> Send a SOAP action header? (overrides the Header Manager)
</td>
<td>
No
</td>
</tr>
<tr>
<td>Soap/XML-RPC Data</td>
<td> The Soap XML message, or XML-RPC instructions.
Not used if the filename is provided.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Filename</td>
<td> If specified, then the contents of the file are sent, and the Data field is ignored
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="WebService(SOAP)_Request"><h3>18.1.6 WebService(SOAP) Request</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This sampler has been tested with IIS Webservice running .NET 1.0 and .NET 1.1.
It has been tested with SUN JWSDP, IBM webservices, Axis and gSoap toolkit for C/C++.
The sampler uses Apache SOAP driver to serialize the message and set the header
with the correct SOAPAction. Right now the sampler doesn't support automatic WSDL
handling, since Apache SOAP currently does not provide support for it. Both IBM
and SUN provide WSDL drivers. There are 3 options for the post data: text area,
external file, or directory. If you want the sampler to randomly select a message,
use the directory. Otherwise, use the text area or a file. The if either the
file or path are set, it will not use the message in the text area. If you need
to test a soap service that uses different encoding, use the file or path. If you
paste the message in to text area, it will not retain the encoding and will result
in errors. Save your message to a file with the proper encoding, and the sampler
will read it as java.io.FileInputStream.
</p>
<p >
The sampler requires mail.jar and activation.jar. This is because Apache SOAP
requires the libs. Because mail.jar and activation.jar are distributed by Sun,
you have to download it separately.
</p>
<p >
An important note on the sampler is it will automatically use the proxy host
and port passed to JMeter from command line, if thoe fields in the sampler are
left blank. If a sampler has values in the proxy host and port text field, it
will use the ones provided by the user. This behavior may not be what users
expect.
</p>
<p >
By default, the webservice sampler set SOAPHTTPConnection.setMaintainSession
(true). If you need to maintain the session, add a blank Header Manager. The
sampler uses the Header Manager to store the SOAPHTTPConnection object, since
there apache soap does provide a easy way to get and set the cookies.
</p>
<p >
<b >
Note:
</b>
If you are using CSVDataSet, do not check "Memory Cache". If memory
cache is checked, it will not iterate to the next value. That means all the requests
will use the first value.
</p>
<p >
Make sure you use &lt;soap:Envelope rather than &lt;Envelope. For example:
</p>
<pre >
&lt;?xml version="1.0" encoding="utf-8"?>
&lt;soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
&lt;soap:Body>
&lt;foo xmlns="http://clients-xlmns"/>
&lt;/soap:Body>
&lt;/soap:Envelope>
</pre>
<p><b>Control Panel</b></p>
<div align="center"><img width='536' height='934' src="../images/screenshots/webservice_sampler.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this sampler
that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>WSDL URL</td>
<td> The WSDL URL with the service description.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Webmethods</td>
<td> The WSDL URL with the service description.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Protocol</td>
<td> HTTP or HTTPS are acceptable protocol.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Server Name or IP</td>
<td> The hostname or IP address.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Port Number</td>
<td> Port Number.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Path</td>
<td> Path for the webservice.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>SOAPAction</td>
<td> The SOAPAction defined in the webservice description or WSDL.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Soap/XML-RPC Data</td>
<td> The Soap XML message
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Soap file</td>
<td> File containing soap message
</td>
<td>
No
</td>
</tr>
<tr>
<td>Message Folder</td>
<td> Folder containing soap files
</td>
<td>
No
</td>
</tr>
<tr>
<td>Memory cache</td>
<td>
When using external files, setting this causes the file to be processed once and caches the result.
This may use a lot of memory if there are many different large files.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Use HTTP Proxy</td>
<td> Check box if http proxy should be used
</td>
<td>
No
</td>
</tr>
<tr>
<td>Proxy Host</td>
<td> Proxy hostname
</td>
<td>
No
</td>
</tr>
<tr>
<td>Proxy Port</td>
<td> Proxy host port
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="LDAP_Request"><h3>18.1.7 LDAP Request</h3></a>
</font>
</td></tr>
<tr><td>
This Sampler lets you send a different Ldap request(Add, Modify, Delete and Search) to an LDAP server.
<p >
If you are going to send multiple requests to the same LDAP server, consider
using an
<a href="../usermanual/component_reference.html#LDAP_Request_Defaults">LDAP Request Defaults</a>
Configuration Element so you do not have to enter the same information for each
LDAP Request.
</p>
The same way the
<a href="../usermanual/component_reference.html#Login_Config_Element">Login Config Element</a>
also using for Login and password.
<p><b>Control Panel</b></p>
<div align="center"><img width='505' height='476' src="../images/screenshots/ldap_request.png"></div>
<p >
There are two ways to create test cases for testing an LDAP Server.
</p>
<ol >
<li >
Inbuilt Test cases.
</li>
<li >
User defined Test cases.
</li>
</ol>
<p >
There are four test scenarios of testing LDAP. The tests are given below:
</p>
<ol >
<li >
Add Test
</li>
<ol >
<li >
Inbuilt test :
<p >
This will add a pre-defined entry in the LDAP Server and calculate
the execution time. After execution of the test, the created entry will be
deleted from the LDAP
Server.
</p>
</li>
<li >
User defined test :
<p >
This will add the entry in the LDAP Server. User has to enter all the
attributes in the table.The entries are collected from the table to add. The
execution time is calculated. The created entry will not be deleted after the
test.
</p>
</li>
</ol>
<li >
Modify Test
</li>
<ol >
<li >
Inbuilt test :
<p >
This will create a pre-defined entry first, then will modify the
created entry in the LDAP Server.And calculate the execution time. After
execution
of the test, the created entry will be deleted from the LDAP Server.
</p>
</li>
<li >
User defined test
<p >
This will modify the entry in the LDAP Server. User has to enter all the
attributes in the table. The entries are collected from the table to modify.
The execution time is calculated. The entry will not be deleted from the LDAP
Server.
</p>
</li>
</ol>
<li >
Search Test
</li>
<ol >
<li >
Inbuilt test :
<p >
This will create the entry first, then will search if the attributes
are available. It calculates the execution time of the search query. At the
end of the execution,created entry will be deleted from the LDAP Server.
</p>
</li>
<li >
User defined test
<p >
This will search the user defined entry(Search filter) in the Search
base (again, defined by the user). The entries should be available in the LDAP
Server. The execution time is calculated.
</p>
</li>
</ol>
<li >
Delete Test
</li>
<ol >
<li >
Inbuilt test :
<p >
This will create a pre-defined entry first, then it will be deleted
from the LDAP Server. The execution time is calculated.
</p>
</li>
<li >
User defined test
<p >
This will delete the user-defined entry in the LDAP Server. The entries
should be available in the LDAP Server. The execution time is calculated.
</p>
</li>
</ol>
</ol>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Server Name or IP</td>
<td> Domain name or IP address of the LDAP server.
JMeter assumes the LDAP server is listening on the default port(389).
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Port</td>
<td> default port(389).
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>root DN</td>
<td> DN for the server to communicate
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Username</td>
<td> LDAP server username.
</td>
<td>
Usually
</td>
</tr>
<tr>
<td>Password</td>
<td> LDAP server password.
</td>
<td>
Usually
</td>
</tr>
<tr>
<td>Entry DN</td>
<td> the name of the context to create or Modify; may not be empty Example: do you want to add cn=apache,ou=test
you have to add in table name=cn, value=apache
</td>
<td>
yes
</td>
</tr>
<tr>
<td>Delete</td>
<td> the name of the context to Delete; may not be empty
</td>
<td>
yes
</td>
</tr>
<tr>
<td>Search base</td>
<td> the name of the context or object to search
</td>
<td>
yes
</td>
</tr>
<tr>
<td>Search filter</td>
<td> the filter expression to use for the search; may not be null
</td>
<td>
yes
</td>
</tr>
<tr>
<td>add test</td>
<td> this name, value pair to added in the given context object
</td>
<td>
yes
</td>
</tr>
<tr>
<td>modify test</td>
<td> this name, value pair to add or modify in the given context object
</td>
<td>
yes
</td>
</tr>
</table>
</p>
<p><b>See Also:</b>
<ul>
<li><a href="build-ldap-test-plan.html">Building an Ldap Test Plan</a></li>
<li> <a href="../usermanual/component_reference.html#LDAP_Request_Defaults">LDAP Request Defaults</a>
</li>
</ul>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="LDAP_Extended_Request"><h3>18.1.8 LDAP Extended Request</h3></a>
</font>
</td></tr>
<tr><td>
This Sampler can send all 8 different LDAP request to an LDAP server. It is an extended version of the LDAP sampler,
therefore it is harder to configure, but can be made much closer resembling a real LDAP session.
<p >
If you are going to send multiple requests to the same LDAP server, consider
using an
<a href="../usermanual/component_reference.html#LDAP_Extended_Request_Defaults">LDAP Extended Request Defaults</a>
Configuration Element so you do not have to enter the same information for each
LDAP Request.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='595' height='542' src="../images/screenshots/ldapext_request.png"></div>
<p >
There are nine test operations defined. These operations are given below:
</p>
<ol >
<li >
<b >
Thread bind
</b>
</li>
<p >
Any LDAP request is part of an LDAP session, so the first thing that should be done is starting a session to the LDAP server.
For starting this session a thread bind is used, which is equal to the LDAP "bind" operation.
The user is requested to give a username (Distinguished name) and password,
which will be used to initiate a session.
When no password, or the wrong password is specified, an anonymous session is started. Take care,
omitting the password will not fail this test, a wrong password will.
</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>Name</td>
<td> Descriptive name for this sampler that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Servername</td>
<td> The name (or IP-address) of the LDAP server.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Port</td>
<td> The port number that the LDAP server is listening to. If this is omitted
JMeter assumes the LDAP server is listening on the default port(389).
</td>
<td>
No
</td>
</tr>
<tr>
<td>DN</td>
<td> The distinguished name of the base object that will be used for any subsequent operation.
It can be used as a starting point for all operations. You cannot start any operation on a higher level than this DN!
</td>
<td>
No
</td>
</tr>
<tr>
<td>Username</td>
<td> Full distinguished name of the user as which you want to bind.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Password</td>
<td> Password for the above user. If omitted it will result in an anonymous bind.
If is is incorrect, the sampler will return an error and revert to an anonymous bind.
</td>
<td>
No
</td>
</tr>
</table>
</p>
<br >
</br>
<li >
<b >
Thread unbind
</b>
</li>
<p >
This is simply the operation to end a session.
It is equal to the LDAP "unbind" operation.
</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>Name</td>
<td> Descriptive name for this sampler that is shown in the tree.
</td>
<td>
No
</td>
</tr>
</table>
</p>
<br >
</br>
<li >
<b >
Single bind/unbind
</b>
</li>
<p >
This is a combination of the LDAP "bind" and "unbind" operations.
It can be used for an authentication request/password check for any user. It will open an new session, just to
check the validity of the user/password combination, and end the session again.
</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>Name</td>
<td> Descriptive name for this sampler that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Username</td>
<td> Full distinguished name of the user as which you want to bind.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Password</td>
<td> Password for the above user. If omitted it will result in an anonymous bind.
If is is incorrect, the sampler will return an error.
</td>
<td>
No
</td>
</tr>
</table>
</p>
<br >
</br>
<li >
<b >
Rename entry
</b>
</li>
<p >
This is the LDAP "moddn" operation. It can be used to rename an entry, but
also for moving an entry or a complete subtree to a different place in
the LDAP tree.
</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>Name</td>
<td> Descriptive name for this sampler that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Old entry name</td>
<td> The current distinguished name of the object you want to rename or move,
relative to the given DN in the thread bind operation.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>New distinguished name</td>
<td> The new distinguished name of the object you want to rename or move,
relative to the given DN in the thread bind operation.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
<br >
</br>
<li >
<b >
Add test
</b>
</li>
<p >
This is the ldap "add" operation. It can be used to add any kind of
object to the LDAP server.
</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>Name</td>
<td> Descriptive name for this sampler that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Entry DN</td>
<td> Distinguished name of the object you want to add, relative to the given DN in the thread bind operation.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Add test</td>
<td> A list of attributes and their values you want to use for the object.
If you need to add a multiple value attribute, you need to add the same attribute with their respective
values several times to the list.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
<br >
</br>
<li >
<b >
Delete test
</b>
</li>
<p >
This is the LDAP "delete" operation, it can be used to delete an
object from the LDAP tree
</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>Name</td>
<td> Descriptive name for this sampler that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Delete</td>
<td> Distinguished name of the object you want to delete, relative to the given DN in the thread bind operation.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
<br >
</br>
<li >
<b >
Search test
</b>
</li>
<p >
This is the LDAP "search" operation, and will be used for defining searches.
</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>Name</td>
<td> Descriptive name for this sampler that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Search base</td>
<td> Distinguished name of the subtree you want your
search to look in, relative to the given DN in the thread bind operation.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Search Filter</td>
<td> searchfilter, must be specified in LDAP syntax.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Scope</td>
<td> Use 0 for baseobject-, 1 for onelevel- and 2 for a subtree search. (Default=0)
</td>
<td>
No
</td>
</tr>
<tr>
<td>Size Limit</td>
<td> Specify the maximum number of results you want back from the server. (default=0, which means no limit.) When the sampler hits the maximum number of results, it will fail with errorcode 4
</td>
<td>
No
</td>
</tr>
<tr>
<td>Time Limit</td>
<td> Specify the maximum amount of (cpu)time (in miliseconds) that the server can spend on your search. Take care, this does not say anything about the responsetime. (default is 0, which means no limit)
</td>
<td>
No
</td>
</tr>
<tr>
<td>Attributes</td>
<td> Specify the attributes you want to have returned, seperated by a semicolon. An empty field will return all attributes
</td>
<td>
No
</td>
</tr>
<tr>
<td>Return object</td>
<td> Whether the object will be returned (true) or not (false). Default=false
</td>
<td>
No
</td>
</tr>
<tr>
<td>Dereference aliases</td>
<td> If true, it will dereference aliases, if false, it will not follow them (default=false)
</td>
<td>
No
</td>
</tr>
</table>
</p>
<br >
</br>
<li >
<b >
Modification test
</b>
</li>
<p >
This is the LDAP "modify" operation. It can be used to modify an object. It
can be used to add, delete or replace values of an attribute.
</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>Name</td>
<td> Descriptive name for this sampler that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Entry name</td>
<td> Distinguished name of the object you want to modify, relative
to the given DN in the thread bind operation
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Modification test</td>
<td> The attribute-value-opCode triples. The opCode can be any
valid LDAP operationCode (add, delete/remove or replace). If you don't specify a value with a delete operation,
all values of the given attribute will be deleted. If you do specify a value in a delete operation, only
the given value will be deleted. If this value is non-existent, the sampler will fail the test.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
<br >
</br>
<li >
<b >
Compare
</b>
</li>
<p >
This is the LDAP "compare" operation. It can be used to compare the value
of a given attribute with some already known value. In reality this is mostly
used to check whether a given person is a member of some group. In such a case
you can compare the DN of the user as a given value, with the values in the
attribute "member" of an object of the type groupOfNames.
If the compare operation fails, this test fails with errorcode 49.
</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>Name</td>
<td> Descriptive name for this sampler that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Entry DN</td>
<td> The current distinguished name of the object of
which you want to compare an attribute, relative to the given DN in the thread bind operation.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Compare filter</td>
<td> In the form "attribute=value"
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</ol>
<p><b>See Also:</b>
<ul>
<li><a href="build-ldapext-test-plan.html">Building an LDAP Test Plan</a></li>
<li> <a href="../usermanual/component_reference.html#LDAP_Extended_Request_Defaults">LDAP Extended Request Defaults</a>
</li>
</ul>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Access_Log_Sampler"><h3>18.1.9 Access Log Sampler</h3></a>
</font>
</td></tr>
<tr><td>
<center >
<h2 >
(Alpha Code)
</h2>
</center>
<p >
AccessLogSampler was designed to read access logs and generate http requests.
For those not familiar with the access log, it is the log the webserver maintains of every
request it accepted. This means the every image and html file. The current implementation
is complete, but some features have not been enabled. There is a filter for the access
log parser, but I haven't figured out how to link to the pre-processor. Once I do, changes
to the sampler will be made to enable that functionality.
</p>
<p >
Tomcat uses the common format for access logs. This means any webserver that uses the
common log format can use the AccessLogSampler. Server that use common log format include:
Tomcat, Resin, Weblogic, and SunOne. Common log format looks
like this:
</p>
<p >
127.0.0.1 - - [21/Oct/2003:05:37:21 -0500] "GET /index.jsp?%2Findex.jsp= HTTP/1.1" 200 8343
</p>
<p >
The current implemenation of the parser only looks at the text within the quotes.
Everything else is stripped out and igored. For example, the response code is completely
ignored by the parser. For the future, it might be nice to filter out entries that
do not have a response code of 200. Extending the sampler should be fairly simple. There
are two interfaces you have to implement.
</p>
<p >
org.apache.jmeter.protocol.http.util.accesslog.LogParser
</p>
<p >
org.apache.jmeter.protocol.http.util.accesslog.Generator
</p>
<p >
The current implementation of AccessLogSampler uses the generator to create a new
HTTPSampler. The servername, port and get images are set by AccessLogSampler. Next,
the parser is called with integer 1, telling it to parse one entry. After that,
HTTPSampler.sample() is called to make the request.
<code >
<pre >
samp = (HTTPSampler) GENERATOR.generateRequest();
samp.setDomain(this.getDomain());
samp.setPort(this.getPort());
samp.setImageParser(this.isImageParser());
PARSER.parse(1);
res = samp.sample();
res.setSampleLabel(samp.toString());
</pre>
</code>
The required methods in LogParser are: setGenerator(Generator) and parse(int).
Classes implementing Generator interface should provide concrete implementation
for all the methods. For an example of how to implement either interface, refer to
StandardGenerator and TCLogParser.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='582' height='301' src="../images/screenshots/accesslogsampler.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Server</td>
<td> Domain name or IP address of the web server.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Port</td>
<td> Port the web server is listening to.
</td>
<td>
No (defaults to 80)
</td>
</tr>
<tr>
<td>Log parser class</td>
<td> The log parser class is responsible for parsing the logs.
</td>
<td>
Yes (default provided)
</td>
</tr>
<tr>
<td>Filter</td>
<td> The filter class is used to filter out certain lines.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Location of log file</td>
<td> The location of the access log file.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
<p >
The TCLogParser processes the access log independently for each thread.
The SharedTCLogParser and OrderPreservingLogParser share access to the file,
i.e. each thread gets the next entry in the log.
</p>
<p >
The SessionFilter is intended to handle Cookies across threads.
It does not filter out any entries, but modifies the cookie manager so that the cookies for a given IP are
processed by a single thread at a time. If two threads try to process samples from the same client IP address,
then one will be forced to wait until the other has completed.
</p>
<p >
The LogFilter is intended to allow access log entries to be filtered by filename and regex,
as well as allowing for the replacement of file extensions. However, it is not currently possible
to configure this via the GUI, so it cannot really be used.
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="BeanShell_Sampler"><h3>18.1.10 BeanShell Sampler</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This sampler allows you to write a sampler using the BeanShell scripting language.
</p>
<p >
<b >
Please note that the BeanShell jar file is not included with JMeter; it needs to be separately downloaded.
<br >
</br>
For full details on using BeanShell, please see the BeanShell web-site at http://www.beanshell.org/.
</b>
</p>
<p >
The test element supports the ThreadListener and TestListener methods.
These should be defined in the initialisation file.
See the file BeanShellListeners.bshrc for example definitions.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='592' height='303' src="../images/screenshots/beanshellsampler.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Reset bsh.Interpreter before each call</td>
<td>
If this option is selected, then the interpreter will be recreated for each sample.
This may be necessary for some long running scripts.
For further information, see
<a href="best-practices#bsh_scripting">
Best Practices - BeanShell scripting
</a>
.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Parameters</td>
<td> Parameters to pass to the BeanShell script.
This is intended for use with script files; for scripts defined in the GUI, you can use whatever
variable and function references you need within the script itself.
The parameters are stored in the following variables:
<ul >
<li >
Parameters - string containing the parameters as a single variable
</li>
<li >
bsh.args - String array containing parameters, split on white-space
</li>
</ul>
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script file</td>
<td> A file containing the BeanShell script to run.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script</td>
<td> The BeanShell script to run.
The return value (if not null) is stored as the sampler result.
</td>
<td>
Yes (unless script file is provided)
</td>
</tr>
</table>
</p>
<p >
N.B. Each Sampler instance has its own BeanShell interpeter,
and Samplers are only called from a single thread
</p>
<p >
If the property "beanshell.sampler.init" is defined, it is passed to the Interpreter
as the name of a sourced file.
This can be used to define common methods and variables.
There is a sample init file in the bin directory: BeanShellSampler.bshrc.
</p>
<p >
If a script file is supplied, that will be used, otherwise the script will be used.
</p>
<p >
Before invoking the script, some variables are set up in the BeanShell interpreter:
</p>
<p >
The contents of the Parameters field is put into the variable "Parameters".
The string is also split into separate tokens using a single space as the separator, and the resulting list
is stored in the String array bsh.args.
</p>
<p >
The full list of variables that is set up is as follows:
</p>
<ul >
<li >
log - the Logger
</li>
<li >
Label - the Sampler label
</li>
<li >
FileName - the file name, if any
</li>
<li >
Parameters - text from the Parameters field
</li>
<li >
bsh.args - the parameters, split as described above
</li>
<li >
SampleResult - pointer to the current SampleResult
</li>
<li >
ResponseCode = 200
</li>
<li >
ResponseMessage = "OK"
</li>
<li >
IsSuccess = true
</li>
<li >
ctx - JMeterContext
</li>
<li >
vars - JMeterVariables - e.g. vars.get("VAR1"); vars.put("VAR2","value"); vars.remove("VAR3"); vars.putObject("OBJ1",new Object());
</li>
</ul>
<p >
When the script completes, control is returned to the Sampler, and it copies the contents
of the following script variables into the corresponding variables in the SampleResult:
</p>
<ul >
<li >
ResponseCode - for example 200
</li>
<li >
ResponseMessage - for example "OK"
</li>
<li >
IsSuccess - true/false
</li>
</ul>
<p >
The Sampler ResponseData is set from the return value of the script.
Since version 2.1.2, if the script returns null, it can set the response directly, by using the method
SampleResponse.setResponseData(data), where data is either a String or a byte array.
The data type defaults to "text", but can be set to binary by using the method
SampleResponse.setDataType(SampleResponse.BINARY).
</p>
<p >
The SampleResult variable gives the script full access to all the fields and
methods in the SampleResult. For example, the script has access to the methods
setStopThread(boolean) and setStopTest(boolean).
Here is a simple (not very useful!) example script:
</p>
<pre >
if (bsh.args[0].equalsIgnoreCase("StopThread")) {
log.info("Stop Thread detected!");
SampleResult.setStopThread(true);
}
return "Data from sample with Label "+Label;
//or, since version 2.1.2
SampleResult.setResponseData("My data");
return null;
</pre>
<p >
Another example:
<br >
</br>
ensure that the property
<b >
beanshell.sampler.init=BeanShellSampler.bshrc
</b>
is defined in jmeter.properties.
The following script will show the values of all the variables in the ResponseData field:
</p>
<pre >
return getVariables();
</pre>
<p >
For details on the methods available for the various classes (JMeterVariables, SampleResult etc) please check the Javadoc or the source code.
Beware however that misuse of any methods can cause subtle faults that may be difficult to find ...
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="BSF_Sampler"><h3>18.1.11 BSF Sampler</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This sampler allows you to write a sampler using a BSF scripting language.
<br >
</br>
See the
<a href="http://jakarta.apache.org/bsf/index.html">
Apache Bean Scripting Framework
</a>
website for details of the languages supported.
You may need to download the appropriate jars for the language; they should be put in the JMeter
<b >
lib
</b>
directory.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='396' height='217' src="../images/screenshots/bsfsampler.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Scripting Language</td>
<td> Name of the BSF scripting language to be used.
N.B. Not all the languages in the drop-down list are supported by default.
The following are supported: beanshell, jacl, javascript, xslt.
Others may be available if the appropriate jar is installed in the JMeter lib directory.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Script File</td>
<td> Name of a file to be used as a BSF script
</td>
<td>
No
</td>
</tr>
<tr>
<td>Parameters</td>
<td> List of parameters to be passed to the script file or the script.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script</td>
<td> Script to be passed to BSF language
</td>
<td>
Yes (unless script file is provided)
</td>
</tr>
</table>
</p>
<p >
If a script file is supplied, that will be used, otherwise the script will be used.
</p>
<p >
Before invoking the script, some variables are set up:
</p>
<ul >
<li >
log - the Logger
</li>
<li >
Label - the Sampler label
</li>
<li >
FileName - the file name, if any
</li>
<li >
Parameters - text from the Parameters field
</li>
<li >
args - the parameters, split as described above
</li>
<li >
SampleResult - pointer to the current SampleResult
</li>
<li >
ctx - JMeterContext
</li>
<li >
vars - JMeterVariables - e.g. vars.get("VAR1"); vars.put("VAR2","value"); vars.remove("VAR3"); vars.putObject("OBJ1",new Object());
</li>
</ul>
<p >
The Sampler ResponseData is set from the return value of the script.
If the script returns null, it can set the response directly, by using the method
SampleResponse.setResponseData(data), where data is either a String or a byte array.
The data type defaults to "text", but can be set to binary by using the method
SampleResponse.setDataType(SampleResponse.BINARY).
</p>
<p >
The SampleResult variable gives the script full access to all the fields and
methods in the SampleResult. For example, the script has access to the methods
setStopThread(boolean) and setStopTest(boolean).
</p>
<p >
Unlike the Beanshell Sampler, the BSF Sampler does not set the ResponseCode, ResponseMessage and sample status via script variables.
Currently the only way to changes these is via the SampleResponse methods:
<ul >
<li >
SampleResponse.setSuccessful(true/false)
</li>
<li >
SampleResponse.setResponseCode("code")
</li>
<li >
SampleResponse.setResponseMessage("message")
</li>
</ul>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="TCP_Sampler"><h3>18.1.12 TCP Sampler</h3></a>
</font>
</td></tr>
<tr><td>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> ALPHA CODE
</td></tr>
</table></p>
<p >
The TCP Sampler opens a TCP/IP connection to the specified server.
It then sends the text, and waits for a response.
<br >
</br>
Connections are shared between Samplers in the same thread, provided that the exact
same host name string and port are used.
To force a different socket to be used, change the hostname by changing the case
of one of the letters, e.g. www.apache.org and wWw.apache.org will use different
sockets.
<br >
</br>
If an error is detected, the socket is closed.
Another socket will be reopened on the next sample.
<br >
</br>
The following properties can be used to control its operation:
</p>
<ul >
<li >
tcp.status.prefix - text that precedes a status number
</li>
<li >
tcp.status.suffix - text that follows a status number
</li>
<li >
tcp.status.properties - name of property file to convert status codes to messages
</li>
<li >
tcp.handler - Name of TCP Handler class (default TCPClientImpl)
</li>
<li >
tcp.eolByte - decimal value. Defines the end of line byte value; used to determine when a response has been received
</li>
</ul>
The class that handles the connection is defined by the property tcp.handler.
If not found, the class is then searched for in the package org.apache.jmeter.protocol.tcp.sampler.
<p >
Users can provide their own implementation to replace the supplied class TCPClientImpl.
The class must extend org.apache.jmeter.protocol.tcp.sampler.TCPClient.
</p>
If tcp.status.prefix is defined, then the response message is searched for the text following
that up to the suffix. If any such text is found, it is used to set the response code.
The response message is then fetched from the properties file (if provided).
<br >
</br>
For example, if the prefix = "[" and the suffix = "]", then the following repsonse:
<br >
</br>
[J28] XI123,23,GBP,CR
<br >
</br>
would have the response code J28.
<br >
</br>
Response codes in the range "400"-"499" and "500"-"599" are currently regarded as failures;
all others are successful. [This needs to be made configurable!]
<br >
</br>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> The login name/password are not used by the supplied TCP implementation.
</td></tr>
</table></p>
<br >
</br>
Sockets are disconnected at the end of a test run.
<p><b>Control Panel</b></p>
<div align="center"><img width='631' height='305' src="../images/screenshots/tcpsampler.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>ServerName or IP</td>
<td> Name or IP of TCP server
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Port Number</td>
<td> Port to be used
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Timeout (milliseconds)</td>
<td> Timeout for replies
</td>
<td>
No
</td>
</tr>
<tr>
<td>Set Nodelay</td>
<td> Should the nodelay property be set?
</td>
<td>
No
</td>
</tr>
<tr>
<td>Text to Send</td>
<td> Text to be sent
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Login User</td>
<td> User Name
</td>
<td>
No
</td>
</tr>
<tr>
<td>Password</td>
<td> Password
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="JMS_Publisher"><h3>18.1.13 JMS Publisher</h3></a>
</font>
</td></tr>
<tr><td>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> ALPHA CODE
</td></tr>
</table></p>
<p >
JMS Publisher will publish messages to a given pub/sub topic. For those not
familiar with JMS, it is the J2EE specification for messaging. There are
numerous JMS servers on the market and several open source options.
</p>
<br >
</br>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> JMeter does not include the JMS jar; this must be downloaded and put in the lib directory
</td></tr>
</table></p>
<p><b>Control Panel</b></p>
<div align="center"><img width='438' height='750' src="../images/screenshots/jmspublisher.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>use JNDI properties file</td>
<td> use jndi.properties to create topic
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>JNDI Initial Context Factory</td>
<td> Name of the context factory
</td>
<td>
No
</td>
</tr>
<tr>
<td>Provider URL</td>
<td> The URL for the jms provider
</td>
<td>
No
</td>
</tr>
<tr>
<td>Topic</td>
<td> the message topic
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Authentication</td>
<td> Authentication requirement for the JMS provider
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>User</td>
<td> User Name
</td>
<td>
No
</td>
</tr>
<tr>
<td>Password</td>
<td> Password
</td>
<td>
No
</td>
</tr>
<tr>
<td>Number of samples to aggregate</td>
<td> number of samples to aggregate
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>configuration</td>
<td> setting for the message
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Message type</td>
<td> text or object message
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="JMS_Subscriber"><h3>18.1.14 JMS Subscriber</h3></a>
</font>
</td></tr>
<tr><td>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> ALPHA CODE
</td></tr>
</table></p>
<p >
JMS Publisher will subscribe to messages in a given pub/sub topic. For those not
familiar with JMS, it is the J2EE specification for messaging. There are
numerous JMS servers on the market and several open source options.
</p>
<br >
</br>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> JMeter does not include the JMS jar; this must be downloaded and put in the lib directory
</td></tr>
</table></p>
<p><b>Control Panel</b></p>
<div align="center"><img width='497' height='434' src="../images/screenshots/jmssubscriber.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>use JNDI properties file</td>
<td> use jndi.properties to create topic
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>JNDI Initial Context Factory</td>
<td> Name of the context factory
</td>
<td>
No
</td>
</tr>
<tr>
<td>Provider URL</td>
<td> The URL for the jms provider
</td>
<td>
No
</td>
</tr>
<tr>
<td>Topic</td>
<td> the message topic
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Authentication</td>
<td> Authentication requirement for the JMS provider
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>User</td>
<td> User Name
</td>
<td>
No
</td>
</tr>
<tr>
<td>Password</td>
<td> Password
</td>
<td>
No
</td>
</tr>
<tr>
<td>Number of samples to aggregate</td>
<td> number of samples to aggregate
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Read response</td>
<td> should the sampler read the response
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Client</td>
<td> Which client to use
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="JMS_Point-to-Point"><h3>18.1.15 JMS Point-to-Point</h3></a>
</font>
</td></tr>
<tr><td>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> ALPHA CODE
</td></tr>
</table></p>
<p >
This sampler sends and optionally receives JMS Messages through point-to-point connections (queues).
It is different from pub/sub messages and is generally used for handling transactions.
</p>
<br >
</br>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> JMeter does not include the JMS jar; this must be downloaded and put in the lib directory
</td></tr>
</table></p>
<p><b>Control Panel</b></p>
<div align="center"><img width='568' height='730' src="../images/screenshots/jms/JMS_Point-to-Point.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>QueueConnection Factory</td>
<td>
The JNDI name of the queue connection factory to use for connecting to the messaging system.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>JNDI Name Request queue</td>
<td>
This is the JNDI name of the queue to which the messages are sent.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>JNDI Name Reply queue</td>
<td>
The JNDI name of the receiving queue. If a value is provided here and the communication style is Request Response
this queue will be monitored for responses to the requests sent.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Communication style</td>
<td>
The Communication style can be Request Only (also known as Fire and Forget) or Request Reply.
Request Only will only sent messages and will not monitor replies. As such it can be used to put load on a system.
Request Reply will sent messages and monitor the replies it receives. Behaviour is depended on the value of the JNDI Name Reply Queue.
If JNDI Name Reply Queue has a value, this queue is used to monitor the results. Matching of request and reply is done with
the message id of the request with the correlation id of the reply. If the JNDI Name Reply Queue is empty, then
temporary queues will be used for the communication between the requestor and the server. This is very different from
the fixed reply queue. With temporary queues the diffent threads will block until the reply message has been received.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Timeout</td>
<td>
The timeout in milliseconds for the reply-messages. If a reply has not been received within the specified
time, the specific testcase failes and the specific reply message received after the timeout is discarded.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Use non-persistent delivery mode?</td>
<td>
Whether to set DeliveryMode.NON_PERSISTENT.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Content</td>
<td>
The content of the message.
</td>
<td>
No
</td>
</tr>
<tr>
<td>JMS Properties</td>
<td>
The JMS Properties are properties specific for the underlying messaging system.
For example: for WebSphere 5.1 web services you will need to set the JMS Property targetService to test
webservices through JMS.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Initial Context Factory</td>
<td>
The Initial Context Factory is the factory to be used to look up the JMS Resources.
</td>
<td>
No
</td>
</tr>
<tr>
<td>JNDI properties</td>
<td>
The JNDI Properties are the specific properties for the underlying JNDI implementation.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Provider URL</td>
<td>
The URL for the jms provider.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="JUnit_Request"><h3>18.1.16 JUnit Request</h3></a>
</font>
</td></tr>
<tr><td>
The current implementation supports standard Junit convention and extensions. It also
includes extensions like oneTimeSetUp and oneTimeTearDown. The sampler works like the
JavaSampler with some differences.
<br >
</br>
1. rather than use Jmeter's test interface, it scans the jar files for classes extending junit's TestCase class. That includes any class or subclass.
<br >
</br>
2. Junit test jar files should be placed in jmeter/lib/junit instead of /lib directory.
<br >
</br>
3. Junit sampler does not use name/value pairs for configuration like the JavaSampler. The sampler assumes setUp and tearDown will configure the test correctly.
<br >
</br>
4. The sampler measures the elapsed time only for the test method and does not include setUp and tearDown.
<br >
</br>
5. Each time the test method is called, Jmeter will pass the result to the listeners.
<br >
</br>
6. Support for oneTimeSetUp and oneTimeTearDown is done as a method. Since Jmeter is multi-threaded, we cannot call oneTimeSetUp/oneTimeTearDown the same way Maven does it.
<br >
</br>
7. The sampler reports unexpected exceptions as errors.
There are some important differences between standard JUnit test runners and JMeter's
implementation. Rather than make a new instance of the class for each test, JMeter
creates 1 instance per sampler and reuses it.
<br >
</br>
The current implementation of the sampler will try to create an instance using the string constructor first. If the test class does not declare a string constructor, the sampler will look for an empty constructor. Example below:<br>
<br>
Empty Constructor:<br>
public class myTestCase {<br>
public myTestCase() {}<br>
}<br>
<br>
String Constructor:<br>
public class myTestCase {<br>
public myTestCase(String text) {<br>
super(text);<br>
}<br>
}<br>
By default, Jmeter will provide some default values for the success/failure code and message. Users should define a set of unique success and failure codes and use them uniformly across all tests.<br>
General Guidelines
<br >
</br>
If you use setUp and tearDown, make sure the methods are declared public. If you do not, the test may not run properly.
<br >
</br>
Here are some general guidelines for writing Junit tests so they work well with Jmeter. Since Jmeter runs multi-threaded, it is important to keep certain things in mind.<br>
<br>
1. Write the setUp and tearDown methods so they are thread safe. This generally means avoid using static memebers.<br>
2. Make the test methods discrete units of work and not long sequences of actions. By keeping the test method to a descrete operation, it makes it easier to combine test methods to create new test plans.<br>
3. Avoid making test methods depend on each other. Since Jmeter allows arbitrary sequencing of test methods, the runtime behavior is different than the default Junit behavior.<br>
4. If a test method is configurable, be careful about where the properties are stored. Reading the properties from the Jar file is recommended.<br>
5. Each sampler creates an instance of the test class, so write your test so the setup happens in oneTimeSetUp and oneTimeTearDown.
<p><b>Control Panel</b></p>
<div align="center"><img width='522' height='405' src="../images/screenshots/junit_sampler.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Package filter</td>
<td> Comma separated list of packages to show. Example, org.apache.jmeter,junit.framework.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Class name</td>
<td> Fully qualified name of the JUnit test class.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Constructor string</td>
<td> String pass to the string constructor. If a string is set, the sampler will use the
string constructor instead of the empty constructor.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Test method</td>
<td> The method to test.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Success message</td>
<td> A descriptive message indicating what success means.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Success code</td>
<td> An unique code indicating the test was successful.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Failure message</td>
<td> A descriptive message indicating what failure means.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Failure code</td>
<td> An unique code indicating the test failed.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Error message</td>
<td> A description for errors.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Error code</td>
<td> Some code for errors. Does not need to be unique.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Do not call setUp and tearDown</td>
<td> Set the sampler not to call setUp and tearDown.
By default, setUp and tearDown should be called. Not calling those methods could affect the test and make it inaccurate.
This option should only be used with calling oneTimeSetUp and oneTimeTearDown. If the selected method is oneTimeSetUp or oneTimeTearDown,
this option should be checked.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Mail_Reader_Sampler"><h3>18.1.17 Mail Reader Sampler</h3></a>
</font>
</td></tr>
<tr><td>
TBA
<p><b>Control Panel</b></p>
<div align="center"><img width='344' height='318' src="../images/screenshots/mailreader_sampler.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Test_Action"><h3>18.1.18 Test Action</h3></a>
</font>
</td></tr>
<tr><td>
The Test Action sampler is a sampler that is intended for use in a conditional controller.
Rather than generate a sample, the test element eithers pauses - or stops the selected target.
<p >
This sampler can also be useful in conjunction with the Transaction Controller, as it allows
pauses to be included without needing to generate a sample.
For variable delays, set the pause time to zero, and add a Timer as a child.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='351' height='182' src="../images/screenshots/test_action.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Target</td>
<td> Current Thread / All Threads (ignored for Pause)
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Action</td>
<td> Pause / Stop
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Duration</td>
<td> How long to pause for (milliseconds)
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<a href="#">
^
</a>
</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="logic_controllers"><strong>18.2 Logic Controllers</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<description >
<br >
Logic Controllers determine the order in which Samplers are processed.
</br>
</description>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Simple_Controller"><h3>18.2.1 Simple Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Simple Logic Controller lets you organize your Samplers and other
Logic Controllers. Unlike other Logic Controllers, this controller provides no functionality beyond that of a
storage device.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='390' height='62' src="../images/screenshots/logic-controller/simple-controller.gif"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
</table>
</p>
<a name="simple_controller_example"/>
<p><b>Using the Simple Controller</b></p>
<p >
<a href="../demos/SimpleTestPlan.jmx">
Download
</a>
this example (see Figure 6).
In this example, we created a Test Plan that sends two Ant HTTP requests and two
Log4J HTTP requests. We grouped the Ant and Log4J requests by placing them inside
Simple Logic Controllers. Remember, the Simple Logic Controller has no effect on how JMeter
processes the controller(s) you add to it. So, in this example, JMeter sends the requests in the
following order: Ant Home Page, Ant News Page, Log4J Home Page, Log4J History Page.
Note, the File Reporter
is configured to store the results in a file named "simple-test.dat" in the current directory.
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/logic-controller/simple-example.gif"><br>
<font size="-1"> Figure 6 Simple Controller Example
</font></td></tr></table></p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Loop_Controller"><h3>18.2.2 Loop Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
If you add Generative or Logic Controllers to a Loop Controller, JMeter will
loop through them a certain number of times, in addition to the loop value you
specified for the Thread Group. For example, if you add one HTTP Request to a
Loop Controller with a loop count of two, and configure the Thread Group loop
count to three, JMeter will send a total of 2 * 3 = 6 HTTP Requests.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='397' height='111' src="../images/screenshots/logic-controller/loop-controller.gif"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Loop Count</td>
<td>
The number of times the subelements of this controller will be iterated each time
through a test run.
<p >
<b >
Special Case:
</b>
The Loop Controller embedded in the
<a href="test_plan.html#thread_group">
Thread Group
</a>
element behaves slightly differently. Unless set to forever, it stops the test after
the given number of iterations have been done.
</p>
</td>
<td>
Yes, unless "Forever" is checked
</td>
</tr>
</table>
</p>
<a name="loop_example"/>
<p><b>Looping Example</b></p>
<p >
<a href="../demos/LoopTestPlan.jmx">
Download
</a>
this example (see Figure 4).
In this example, we created a Test Plan that sends a particular HTTP Request
only once and sends another HTTP Request five times.
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/logic-controller/loop-example.gif"><br>
<font size="-1"> Figure 4 - Loop Controller Example
</font></td></tr></table></p>
<p >
We configured the Thread Group for a single thread and a loop count value of
one. Instead of letting the Thread Group control the looping, we used a Loop
Controller. You can see that we added one HTTP Request to the Thread Group and
another HTTP Request to a Loop Controller. We configured the Loop Controller
with a loop count value of five.
</p>
<p >
JMeter will send the requests in the following order: Home Page, News Page,
News Page, News Page, News Page, and News Page. Note, the File Reporter
is configured to store the results in a file named "loop-test.dat" in the current directory.
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Once_Only_Controller"><h3>18.2.3 Once Only Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Once Only Logic Controller tells JMeter to process the controller(s) inside it only once, and pass over any requests under it
during further iterations through the test plan.
</p>
<p >
The Once Only Controller will now execute always during the first iteration of any looping parent controller. Thus, if the Once Only Controller is placed under a Loop Controller specified to loop 5 times, then the Once Only Controller will execute only on the first iteration through the Loop Controller (ie, every 5 times). Note this means the Once Only Controller will still behave as previously expected if put under a Thread Group (runs only once per test), but now the user has more flexibility in the use of the Once Only Controller.
</p>
<p >
For testing that requires a login, consider placing the login request in this controller since each thread only needs
to login once to establish a session.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='390' height='62' src="../images/screenshots/logic-controller/once-only-controller.gif"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
</table>
</p>
<a name="once_only_example"/>
<p><b>Once Only Example</b></p>
<p >
<a href="../demos/OnceOnlyTestPlan.jmx">
Download
</a>
this example (see Figure 5).
In this example, we created a Test Plan that has two threads that send HTTP request.
Each thread sends one request to the Home Page, followed by three requests to the Bug Page.
Although we configured the Thread Group to iterate three times, each JMeter thread only
sends one request to the Home Page because this request lives inside a Once Only Controller.
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/logic-controller/once-only-example.png"><br>
<font size="-1"> Figure 5. Once Only Controller Example
</font></td></tr></table></p>
<p >
Each JMeter thread will send the requests in the following order: Home Page, Bug Page,
Bug Page, Bug Page. Note, the File Reporter is configured to store the results in a file named "loop-test.dat" in the current directory.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> The behaviour of the Once Only controller under anything other than the
Thread Group or a Loop Controller is not currently defined. Odd things may happen.
</td></tr>
</table></p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Interleave_Controller"><h3>18.2.4 Interleave Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
If you add Generative or Logic Controllers to an Interleave Controller, JMeter will alternate among each of the
other controllers for each loop iteration.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='219' height='90' src="../images/screenshots/logic-controller/interleave-controller.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>ignore sub-controller blocks</td>
<td> If checked, the interleave controller will treat sub-controllers like single request elements and only allow one request per controller at a time.
</td>
<td>
No
</td>
</tr>
</table>
</p>
<a name="simple_interleave_example"/>
<p><b>Simple Interleave Example</b></p>
<p >
<a href="../demos/InterleaveTestPlan.jmx">
Download
</a>
this example (see Figure 1). In this example,
we configured the Thread Group to have two threads and a loop count of five, for a total of ten
requests per thread. See the table below for the sequence JMeter sends the HTTP Requests.
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/logic-controller/interleave.png"><br>
<font size="-1"> Figure 1 - Interleave Controller Example 1
</font></td></tr></table></p>
<table>
<tr>
<td bgcolor="#039acc" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Loop Iteration
</font>
</td>
<td bgcolor="#039acc" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Each JMeter Thread Sends These HTTP Requests
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
1
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
News Page
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Log Page
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
FAQ Page
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Log Page
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
3
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Gump Page
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Log Page
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
4
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Because there are no more requests in the controller,<br> </br> JMeter starts over and sends the first HTTP Request, which is the News Page.
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Log Page
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
5
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
FAQ Page
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Log Page
</font>
</td>
</tr>
</table>
<a name="useful_interleave_example"/>
<p><b>Useful Interleave Example</b></p>
<p >
<a href="../demos/InterleaveTestPlan2.jmx">
Download
</a>
another example (see Figure 2). In this
example, we configured the Thread Group
to have a single thread and a loop count of eight. Notice that the Test Plan has an outer Interleave Controller with
two Interleave Controllers inside of it.
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/logic-controller/interleave2.png"><br>
<font size="-1">
Figure 2 - Interleave Controller Example 2
</font></td></tr></table></p>
<p >
The outer Interleave Controller alternates between the
two inner ones. Then, each inner Interleave Controller alternates between each of the HTTP Requests. Each JMeter
thread will send the requests in the following order: Home Page, Interleaved, Bug Page, Interleaved, CVS Page, Interleaved, and FAQ Page, Interleaved.
Note, the File Reporter is configured to store the results in a file named "interleave-test2.dat" in the current directory.
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/logic-controller/interleave3.png"><br>
<font size="-1">
Figure 3 - Interleave Controller Example 3
</font></td></tr></table></p>
<p >
If the two interleave controllers under the main interleave controller were instead simple controllers, then the order would be: Home Page, CVS Page, Interleaved, Bug Page, FAQ Page, Interleaved. However, if "ignore sub-controller blocks" was checked on the main interleave controller, then the order would be: Home Page, Interleaved, Bug Page, Interleaved, CVS Page, Interleaved, and FAQ Page, Interleaved.
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Random_Controller"><h3>18.2.5 Random Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Random Logic Controller acts similarly to the Interleave Controller, except that
instead of going in order through its sub-controllers and samplers, it picks one
at random at each pass.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> Interactions between multiple controllers can yield complex behavior.
This is particularly true of the Random Controller. Experiment before you assume
what results any given interaction will give
</td></tr>
</table></p>
<p><b>Control Panel</b></p>
<div align="center"><img width='238' height='84' src="../images/screenshots/logic-controller/random-controller.gif"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Random_Order_Controller"><h3>18.2.6 Random Order Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Random Order Controller is much like a Simple Controller in that it will execute each child
element at most once, but the order of execution of the nodes will be random.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='358' height='131' src="../images/screenshots/randomordercontroller.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Throughput_Controller"><h3>18.2.7 Throughput Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
<b >
This controller is badly named, as it does not control throughput.
</b>
Please refer to the
<a href="../usermanual/component_reference.html#Constant_Throughput_Timer">Constant Throughput Timer</a>
for an element that can be used to adjust the throughput.
</p>
<p >
The Throughput Controller allows the user to control how often it is executed. There are two modes - percent execution and total executions. Percent executions causes the controller to execute a certain percentage of the iterations through the test plan. Total
executions causes the controller to stop executing after a certain number of executions have occurred. Like the Once Only Controller, this
setting is reset when a parent Loop Controller restarts.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='223' height='148' src="../images/screenshots/throughput_controller.png"></div>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> The Throughput Controller can yield very complex behavior when combined with other controllers - in particular with interleave or random controllers as parents (also very useful).
</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>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Execution Style</td>
<td> Whether the controller will run in percent executions or total executions mode.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Throughput</td>
<td> A number. for percent execution mode, a number from 0-100 that indicates the percentage of times the controller will execute. "50" means the controller will execute during half the iterations throught the test plan. for total execution mode, the number indicates the total number of times the controller will execute.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Per User</td>
<td> If checked, per user will cause the controller to calculate whether it should execute on a per user (per thread) basis. if unchecked, then the calculation will be global for all users. for example, if using total execution mode, and uncheck "per user", then the number given for throughput will be the total number of executions made. if "per user" is checked, then the total number of executions would be the number of users times the number given for throughput.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Runtime_Controller"><h3>18.2.8 Runtime Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Runtime Controller controls how long its children are allowed to run.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='358' height='131' src="../images/screenshots/runtimecontroller.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree, and used to name the transaction.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Runtime (seconds)</td>
<td> Desired runtime in seconds
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="If_Controller"><h3>18.2.9 If Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The If Controller allows the user to control whether the test elements below it (its children) are run or not.
</p>
<p >
Prior to JMeter 2.3RC3, the condition was evaluated for every runnable element contained in the controller.
This sometimes caused unexpected behaviour, so 2.3RC3 was changed to evaluate the condition only once on initial entry.
However, the original behaviour is also useful, so versions of JMeter after 2.3RC4 have an additional
option to select the original behaviour.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='358' height='131' src="../images/screenshots/ifcontroller.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Condition</td>
<td> <b >
Javascript
</b>
code that returns "true" or "false"
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Evaluate for all children</td>
<td>
Should condition be evaluated for all children?
If not checked, then the condition is only evaluated on entry.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
<p >
Examples:
<ul >
<li >
${COUNT} < 10
</li>
<li >
"${VAR}" == "abcd"
</li>
<li >
${JMeterThread.last_sample_ok} (check if last sample succeeded)
</li>
</ul>
If there is an error interpreting the code, the condition is assumed to be false, and a message is logged in jmeter.log.
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="While_Controller"><h3>18.2.10 While Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The While Controller runs its children until the condition is "false".
</p>
<p >
Possible condition values:
</p>
<ul >
<li >
blank - exit loop when last sample in loop fails
</li>
<li >
LAST - exit loop when last sample in loop fails.
If the last sample just before the loop failed, don't enter loop.
</li>
<li >
Otherwise - exit (or don't enter) the loop when the condition is equal to the string "false"
</li>
</ul>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> In contrast to the IfController, the condition is not evaluated as a JavaScript expression.
The condition can be any variable or function that eventually evaluates to the string "false".
This allows the use of JavaScript, BeanShell, properties or variables as needed.
</td></tr>
</table></p>
<br >
</br>
For example:
<ul >
<li >
${VAR} - where VAR is set to false by some other test element
</li>
<li >
${__javaScript(${C}==10,dummy)}
</li>
<li >
${__javaScript("${VAR2}"=="abcd",dummy)}
</li>
<li >
${_P(property)} - where property is set to "false" somewhere else
</li>
</ul>
<p><b>Control Panel</b></p>
<div align="center"><img width='358' height='131' src="../images/screenshots/whilecontroller.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree, and used to name the transaction.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Condition</td>
<td> blank, LAST, or variable/function
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Switch_Controller"><h3>18.2.11 Switch Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Switch Controller acts like the
<a href="../usermanual/component_reference.html#Interleave_Controller">Interleave Controller</a>
in that it runs one of the subordinate elements on each iteration, but rather than
run them in sequence, the controller runs the element defined by the switch value.
</p>
<p >
Note: In versions of JMeter after 2.3.1, the switch value can also be a name.
</p>
<p >
If the switch value is out of range, it will run the zeroth element,
which therefore acts as the default for the numeric case.
It also runs the zeroth element if the value is the empty string.
</p>
<p >
If the value is non-numeric (and non-empty), then the Switch Controller looks for the
element with the same name (case is significant).
If none of the names match, then the element named "default" (case not significant) is selected.
If there is no default, then no element is selected, and the controller will not run anything.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='358' height='131' src="../images/screenshots/switchcontroller.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree, and used to name the transaction.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Switch Value</td>
<td> The number (or name) of the subordinate element to be invoked. Elements are numbered from 0.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="ForEach_Controller"><h3>18.2.12 ForEach Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
A ForEach controller loops through the values of a set of related variables.
When you add samplers (or controllers) to a ForEach controller, every sample sample (or controller)
is executed one or more times, where during every loop the variable has a new value.
The input should consist of several variables, each extended with an underscore and a number.
Each such variable must have a value.
So for example when the input variable has the name inputVar, the following variables should have been defined:
<ul >
<li >
inputVar_1 = wendy
</li>
<li >
inputVar_2 = charles
</li>
<li >
inputVar_3 = peter
</li>
<li >
inputVar_4 = john
</li>
</ul>
<p >
Note: the "_" separator is now optional.
</p>
When the return variable is given as "returnVar", the collection of samplers and controllers under the ForEach controller will be executed 4 consecutive times,
with the return variable having the respective above values, which can then be used in the samplers.
</p>
<p >
It is especially suited for running with the regular expression post-processor.
This can "create" the necessary input variables out of the result data of a previous request.
By omitting the "_" separator, the ForEach Controller can be used to loop through the groups by using
the input variable refName_g, and can also loop through all the groups in all the matches
by using an input variable of the form refName_${C}_g, where C is a counter variable.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> The ForEach Controller does not run any samples if inputVar_1 is null.
This would be the case if the Regular Expression returned no matches.
</td></tr>
</table></p>
<p><b>Control Panel</b></p>
<div align="center"><img width='410' height='153' src="../images/screenshots/logic-controller/foreach-controller.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Input variable prefix</td>
<td> Prefix for the variable names to be used as input.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Output variable</td>
<td>
The name of the variable which can be used in the loop for replacement in the samplers
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Use Separator</td>
<td> If not checked, the "_" separator is omitted.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
<a name="foreach_example"/>
<p><b>ForEach Example</b></p>
<p >
<a href="../demos/forEachTestPlan.jmx">
Download
</a>
this example (see Figure 7).
In this example, we created a Test Plan that sends a particular HTTP Request
only once and sends another HTTP Request to every link that can be found on the page.
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/logic-controller/foreach-example.png"><br>
<font size="-1"> Figure 7 - ForEach Controller Example
</font></td></tr></table></p>
<p >
We configured the Thread Group for a single thread and a loop count value of
one. You can see that we added one HTTP Request to the Thread Group and
another HTTP Request to the ForEach Controller.
</p>
<p >
After the first HTTP request, a regular expression extractor is added, which extracts all the html links
out of the return page and puts them in the inputVar variable
</p>
<p >
In the ForEach loop, a HTTP sampler is added which requests all the links that were extracted from the first returned HTML page.
</p>
<a name="foreach_example2"/>
<p><b>ForEach Example</b></p>
<p >
Here is
<a href="../demos/ForEachTest2.jmx">
another example
</a>
you can download.
This has two Regular Expressions and ForEach Controllers.
The first RE matches, but the second does not match,
so no samples are run by the second ForEach Controller
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/logic-controller/foreach-example2.png"><br>
<font size="-1"> Figure 8 - ForEach Controller Example 2
</font></td></tr></table></p>
<p >
The Thread Group has a single thread and a loop count of two.
</p>
<p >
Sample 1 uses the JavaTest Sampler to return the string "a b c d".
</p>
<p >
The Regex Extractor uses the expression
<b >
(\w)\s
</b>
which matches a letter followed by a space,
and returns the letter (not the space). Any matches are prefixed with the string "inputVar".
</p>
<p >
The ForEach Controller extracts all variables with the prefix "inputVar_", and executes its
sample, passing the value in the variable "returnVar". In this case it will set the variable to the values "a" "b" and "c" in turn.
</p>
<p >
The For 1 Sampler is another Java Sampler which uses the return variable "returnVar" as part of the sample Label
and as the sampler Data.
</p>
<p >
Sample 2, Regex 2 and For 2 are almost identical, except that the Regex has been changed to "(\w)\sx",
which clearly won't match. Thus the For 2 Sampler will not be run.
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Module_Controller"><h3>18.2.13 Module Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Module Controller provides a mechanism for substituting test plan fragments into the current test plan at run-time.
</p>
<p >
A test plan fragment consists of a Controller and all the test elements (samplers etc) contained in it.
The fragment can be located in any Thread Group, or on the
<a href="../usermanual/component_reference.html#WorkBench">WorkBench</a>
.
If the fragment is located in a Thread Group, then its Controller can be disabled to prevent the fragment being run
except by the Module Controller.
Or you can store the fragments in a dummy Thread Group, and disable the entire Thread Group.
</p>
<p >
There can be multiple fragments, each with a different series of
samplers under them. The module controller can then be used to easily switch between these multiple test cases simply by choosing
the appropriate controller in its drop down box. This provides convenience for running many alternate test plans quickly and easily.
</p>
<p >
A fragment name is made up of the Controller name and all its parent names.
For example:
<pre >
Test Plan / Protocol: JDBC / Control / Interleave Controller
</pre>
Any fragments used by the Module Controller must have a unique name,
as the name is used to find the target controller when a test plan is reloaded.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='409' height='255' src="../images/screenshots/module_controller.png"></div>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> The Module Controller should not be used with remote testing or non-gui testing in conjunction with Workbench components since the Workbench test elements are not part of test plan .jmx files. Any such test will fail.
</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>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Module to Run</td>
<td> The module controller provides a list of all controllers loaded into the gui. Select
the one you want to substitute in at runtime.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Include_Controller"><h3>18.2.14 Include Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The include controller is designed to use an external jmx file. To use it, add
samples to a simple controller, then save the simple controller as a jmx file.
The file can then be used in a test plan.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
This element does not support variables/functions in the filename field.
<br >
</br>
However, if the property
<b >
includecontroller.prefix
</b>
is defined,
the contents are used to prefix the pathname.
</td></tr>
</table></p>
<p><b>Control Panel</b></p>
<div align="center"><img width='419' height='118' src="../images/screenshots/includecontroller.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Filename</td>
<td> The file to include.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Transaction_Controller"><h3>18.2.15 Transaction Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Transaction Comntroller is used to group samplers by generating an additional
sample which totals the nested samples.
For JMeter versions after 2.3, there are two modes of operation
<ul >
<li >
additional sample is added after the nested samples
</li>
<li >
additional sample is added as a parent of the nested samples
</li>
</ul>
</p>
<p >
The generated sample time includes all the times for the nested samplers, and any timers etc.
Depending on the clock resolution, it may be slightly longer than the sum of the individual samplers plus timers.
The clock might tick after the controller recorded the start time but before the first sample starts.
Similarly at the end.
</p>
<p >
The generated sample is only regarded as successful if all its sub-samples are successful.
</p>
<p >
In parent mode, the individual samples can still be seen in the Tree View Listener,
but no longer appear as separate entries in other Listeners.
Also, the sub-samples do not appear in CSV log files, but they can be saved to XML files.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
In parent mode, Assertions (etc) can be added to the Transaction Controller.
However by default they will be applied to both the individual samples and the overall transaction sample.
To limit the scope of the Assertions, use a Simple Controller to contain the samples, and add the Assertions
to the Simple Controller.
Parent mode controllers do not currently properly support nested transaction controllers of either type.
</td></tr>
</table></p>
<p><b>Control Panel</b></p>
<div align="center"><img width='258' height='125' src="../images/screenshots/transactioncontroller.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree, and used to name the transaction.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Generate Parent Sample</td>
<td>
If checked, then the sample is generated as a parent of the other samples,
otherwise the sample is generated as an independent sample.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Recording_Controller"><h3>18.2.16 Recording Controller</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Recording Controller is a place holder indicating where the proxy server should
record samples to. During test run, it has no effect, similar to the Simple Controller. But during
recording using the
<a href="../usermanual/component_reference.html#HTTP_Proxy_Server">HTTP Proxy Server</a>
, all recorded samples will by default
be saved under the Recording Controller.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='417' height='70' src="../images/screenshots/logic-controller/recording-controller.gif"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<a href="#">
^
</a>
</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="listeners"><strong>18.3 Listeners</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<description >
<br >
</br>
Most of the listeners perform several roles in addition to "listening"
to the test results.
They also provide means to view, save, and read saved test results.
<p >
Note that Listeners are processed at the end of the scope in which they are found.
</p>
<p >
The saving and reading of test results is generic. The various
listeners have a panel whereby one can specify the file to
which the results will be written (or read from).
By default, the results are stored as XML
files, typically with a ".jtl" extension.
Storing as CSV is the most efficient option, but is less detailed than XML (the other available option).
</p>
<p >
Listeners do not process sample data in non-GUI mode, but the raw data will be saved if an output
file has been configured.
In order to analyse the data generated by a non-GUI test run, you need to load the file into the appropriate
Listener.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> To read existing results and display them, use the file panel Browse button to open the file.
</td></tr>
</table></p>
<p >
Results can be read from XML or CSV format files.
When reading from CSV results files, the header (if present) is used to determine which fields are present.
<b >
In order to interpret a header-less CSV file correctly, the appropriate properties must be set in jmeter.properties.
</b>
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
The file name can contain function and/or variable references.
However variable references do not work in client-server mode (functions work OK).
</td></tr>
</table></p>
<p >
<b >
Listeners can use a lot of memory if there are a lot of samples.
</b>
Most of the listeners currently keep a copy of every sample in their scope, apart from:
</p>
<ul >
<li >
Simple Data Writer
</li>
<li >
BeanShell Listener
</li>
<li >
Assertion Results
</li>
<li >
Mailer Visualizer
</li>
<li >
Monitor Results
</li>
<li >
Summary Report
</li>
</ul>
<p >
To minimise the amount of memory needed, use the Simple Data Writer, and use the CSV format.
</p>
<p >
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
Versions of JMeter after 2.3.1 allow JMeter variables to be saved to the output files.
This can only be specified using a property. See the following link for details.
</td></tr>
</table></p>
For full details on setting up the default items to be saved
see the
<a href="listeners.html#defaults">
Listener Default Configuration
</a>
documentation.
For details of the contents of the output files,
see the
<a href="listeners.html#csvlogformat">
CSV log
</a>
format or
the
<a href="listeners.html#xmlformat2.1">
XML log
</a>
format.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> The entries in jmeter.properties are used to define the defaults;
these can be overriden for individual listeners by using the Configure button,
as shown below.
The settings in jmeter.properties also apply to the listener that is added
by using the -l command-line flag.
</td></tr>
</table></p>
<p >
The figure below shows an example of the result file configuration panel
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/simpledatawriter.png"><br>
<font size="-1"> Result file configuration panel
</font></td></tr></table></p>
</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>File Name</td>
<td> Name of the file containing sample results
</td>
<td>
No
</td>
</tr>
<tr>
<td>Browse...</td>
<td> File Browse Button
</td>
<td>
No
</td>
</tr>
<tr>
<td>Errors</td>
<td> Select this to write/read only results with errors
</td>
<td>
No
</td>
</tr>
<tr>
<td>Successes</td>
<td> Select this to write/read only results without errors.
If neither Errors nor Successes is selected, then all results are processed.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Configure</td>
<td> Configure Button, see below
</td>
<td>
No
</td>
</tr>
</table>
</p>
</description>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Sample_Result_Save_Configuration"><h3>18.3.1 Sample Result Save Configuration</h3></a>
</font>
</td></tr>
<tr><td>
<p >
Listeners can be configured to save different items to the result log files (JTL) by using the Config popup as shown below.
The defaults are defined as described in the
<a href="listeners.html#defaults">
Listener Default Configuration
</a>
documentation.
Items with (CSV) only apply to the CSV format; items wint (XML) only apply to XML format.
CSV format cannot be used to save any items that include line-breaks.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='629' height='300' src="../images/screenshots/sample_result_config.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Graph_Full_Results"><h3>18.3.2 Graph Full Results</h3></a>
</font>
</td></tr>
<tr><td>
No Description
<p><b>Control Panel</b></p>
<div align="center"><img width='672' height='316' src="../images/screenshots/graphfullresults.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Graph_Results"><h3>18.3.3 Graph Results</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Graph Results listener generates a simple graph that plots all sample times. Along
the bottom of the graph, the current sample (black), the current average of all samples(blue), the
current standard deviation (red), and the current throughput rate (green) are displayed in milliseconds.
</p>
<p >
The throughput number represents the actual number of requests/minute the server handled. This calculation
includes any delays you added to your test and JMeter's own internal processing time. The advantage
of doing the calculation like this is that this number represents something
real - your server in fact handled that many requests per minute, and you can increase the number of threads
and/or decrease the delays to discover your server's maximum throughput. Whereas if you made calculations
that factored out delays and JMeter's processing, it would be unclear what you could conclude from that
number.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='605' height='435' src="../images/screenshots/graph_results.png"></div>
<p >
The following table briefly describes the items on the graph.
Further details on the precise meaning of the statistical terms can be found on the web
- e.g. Wikipedia - or by consulting a book on statistics.
</p>
<ul >
<li >
Data - plot the actual data values
</li>
<li >
Average - plot the Average
</li>
<li >
Median - plot the Median (midway value)
</li>
<li >
Deviation - plot the Standard Deviation (a measure of the variation)
</li>
<li >
Throughput - plot the number of samples per unit of time
</li>
</ul>
<p >
The individual figures at the bottom of the display are the current values.
"Latest Sample" is the current elapsed sample time, shown on the graph as "Data".
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Spline_Visualizer"><h3>18.3.4 Spline Visualizer</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Spline Visualizer provides a view of all sample times from the start
of the test till the end, regardless of how many samples have been taken. The spline
has 10 points, each representing 10% of the samples, and connected using spline
logic to show a single continuous line.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='581' height='440' src="../images/screenshots/spline_visualizer.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Assertion_Results"><h3>18.3.5 Assertion Results</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Assertion Results visualizer shows the Label of each sample taken.
It also reports failures of any
<a href="test_plan.html#assertions">
Assertions
</a>
that
are part of the test plan.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='658' height='277' src="../images/screenshots/assertion_results.png"></div>
<p><b>See Also:</b>
<ul>
<li> <a href="../usermanual/component_reference.html#Response_Assertion">Response Assertion</a>
</li>
</ul>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="View_Results_Tree"><h3>18.3.6 View Results Tree</h3></a>
</font>
</td></tr>
<tr><td>
The View Results Tree shows a tree of all sample responses, allowing you to view the
response for any sample. In addition to showing the response, you can see the time it took to get
this response, and some response codes.
Note that the Request panel only shows the headers added by JMeter.
It does not show any headers (such as Host) that may be added by the HTTP protocol implementation.
<p >
There are several ways to view the response, selectable by a radio button.
</p>
<ul >
<li >
Show text
</li>
<li >
Render HTML
</li>
<li >
Render XML
</li>
<li >
Render JSON
</li>
</ul>
<p >
The default "Show text" view shows all of the text contained in the
response.
Note that this will only work if the response content-type is considered to be text.
If the content-type begins with any of the following, it is considered as text,
otherwise it is considered to be binary.
<pre >
text/
application/javascript
application/json
application/soap+xml
application/vnd.wap.xhtml+xml
application/xhtml+xml
application/xml
</pre>
Additional types can be added by defining the JMeter property
<b >
content-type_text
</b>
as a comma-separated list of the content-type prefixes to be matched.
</p>
<p >
If the response data is larger than 200K, then it won't be displayed.
To change this limit, set the JMeter property
<b >
view.results.tree.max_size
</b>
</p>
<p >
The HTML view attempts to render the response as
HTML. The rendered HTML is likely to compare poorly to the view one
would get in any web browser; however, it does provide a quick
approximation that is helpful for initial result evaluation.
If the "Download embedded resources" check-box is selected, the renderer
may download images and style-sheets etc referenced by the HTML.
If the checkbox is not selected, the renderer will not download images etc.
</p>
<p >
The Render XML view will show response in tree style.
Any DTD nodes or Prolog nodes will not show up in tree; however, response may contain those nodes.
</p>
<p >
The Render JSON view will show the response in tree style (also handles JSON embedded in JavaScript).
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='791' height='506' src="../images/screenshots/view_results_tree.png"></div>
<p >
The Control Panel (above) shows an example of an HTML display.
Figure 9 (below) shows an example of an XML display.
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/view_results_tree_xml.png"><br>
<font size="-1"> Figure 9 Sample XML display
</font></td></tr></table></p>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Aggregate_Report"><h3>18.3.7 Aggregate Report</h3></a>
</font>
</td></tr>
<tr><td>
The aggregate report creates a table row for each differently named request in your
test. For each request, it totals the response information and provides request count, min, max,
average, error rate, approximate throughput (request/second) and Kilobytes per second throughput.
Once the test is done, the throughput is the actual through for the duration of the entire test.
<p >
The thoughput is calculated from the point of view of the sampler target
(e.g. the remote server in the case of HTTP samples).
JMeter takes into account the total time over which the requests have been generated.
If other samplers and timers are in the same thread, these will increase the total time,
and therefore reduce the throughput value.
So two identical samplers with different names will have half the throughput of two samplers with the same name.
It is important to choose the sampler names correctly to get the best results from
the Aggregate Report.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
Calculation of the Median and 90% Line (90
<sup >
th
</sup>
<a href="glossary.html#Percentile">
percentile
</a>
) values requires a lot of memory as details of every Sample have to be saved.
See the
<a href="../usermanual/component_reference.html#Summary_Report">Summary Report</a>
for a similar Listener that does not need so much memory.
</td></tr>
</table></p>
<ul >
<li >
Label - The label of the sample.
If "Include group name in label?" is selected, then the name of the thread group is added as a prefix.
This allows identical labels from different thread groups to be collated separately if required.
</li>
<li >
# Samples - The number of samples for the URL
</li>
<li >
Average - The average time of a set of results
</li>
<li >
Median - The
<a href="glossary.html#Median">
median
</a>
is the time in the middle of a set of results.
50% of the samples took no more than this time; the remainder took at least as long.
</li>
<li >
90% Line - 90% of the samples took no more than this time.
The remaining samples at least as long as this. (90
<sup >
th
</sup>
<a href="glossary.html#Percentile">
percentile
</a>
)
</li>
<li >
Min - The shortest time for the samples of the given URL
</li>
<li >
Max - The longest time for the samples of the given URL
</li>
<li >
Error % - Percent of requests with errors
</li>
<li >
Throughput - Throughput measured in requests per second/minute/hour
</li>
<li >
Kb/sec - The throughput measured in Kilobytes per second
</li>
</ul>
<p >
Times are in milliseonds.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='784' height='287' src="../images/screenshots/aggregate_report.png"></div>
<div align="center">
<p >
The figure below shows an example of selecting the "Include group name" checkbox.
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/aggregate_report_grouped.png"><br>
<font size="-1"> Sample "Include group name" display
</font></td></tr></table></p>
</p>
</div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="View_Results_in_Table"><h3>18.3.8 View Results in Table</h3></a>
</font>
</td></tr>
<tr><td>
This visualizer creates a row for every sample result.
Like the
<a href="../usermanual/component_reference.html#View_Results_Tree">View Results Tree</a>
, this visualizer uses a lot of memory.
<p><b>Control Panel</b></p>
<div align="center"><img width='658' height='700' src="../images/screenshots/table_results.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Simple_Data_Writer"><h3>18.3.9 Simple Data Writer</h3></a>
</font>
</td></tr>
<tr><td>
This listener can record results to a file
but not to the UI. It is meant to provide an efficient means of
recording data by eliminating GUI overhead.
When running in non-GUI mode, the -l flag can be used to create a data file.
The fields to save are defined by JMeter properties.
See the jmeter.properties file for details.
<p><b>Control Panel</b></p>
<div align="center"><img width='786' height='145' src="../images/screenshots/simpledatawriter.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Monitor_Results"><h3>18.3.10 Monitor Results</h3></a>
</font>
</td></tr>
<tr><td>
<p >
Monitor Results is a new Visualizer for displaying server
status. It is designed for Tomcat 5, but any servlet container
can port the status servlet and use this monitor. There are two primary
tabs for the monitor. The first is the "Health" tab, which will show the
status of one or more servers. The second tab labled "Performance" shows
the performance for one server for the last 1000 samples. The equations
used for the load calculation is included in the Visualizer.
</p>
<p >
Currently, the primary limitation of the monitor is system memory. A
quick benchmark of memory usage indicates a buffer of 1000 data points for
100 servers would take roughly 10Mb of RAM. On a 1.4Ghz centrino
laptop with 1Gb of ram, the monitor should be able to handle several
hundred servers.
</p>
<p >
As a general rule, monitoring production systems should take care to
set an appropriate interval. Intervals shorter than 5 seconds are too
aggressive and have a potential of impacting the server. With a buffer of
1000 data points at 5 second intervals, the monitor would check the server
status 12 times a minute or 720 times a hour. This means the buffer shows
the performance history of each machine for the last hour.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
The monitor requires Tomcat 5 or above.
Use a browser to check that you can access the Tomcat status servlet OK.
</td></tr>
</table></p>
<p><b>Control Panel</b></p>
<div align="center"><img width='762' height='757' src="../images/screenshots/monitor_screencap.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Distribution_Graph_(alpha)"><h3>18.3.11 Distribution Graph (alpha)</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The distribution graph will display a bar for every unique response time. Since the
granularity of System.currentTimeMillis() is 10 milliseconds, the 90% threshold should be
within the width of the graph. The graph will draw two threshold lines: 50% and 90%.
What this means is 50% of the response times finished between 0 and the line. The same
is true of 90% line. Several tests with Tomcat were performed using 30 threads for 600K
requests. The graph was able to display the distribution without any problems and both
the 50% and 90% line were within the width of the graph. A performant application will
generally produce results that clump together. A poorly written application that has
memory leaks may result in wild fluctuations. In those situations, the threshold lines
may be beyond the width of the graph. The recommended solution to this specific problem
is fix the webapp so it performs well. If your test plan produces distribution graphs
with no apparent clumping or pattern, it may indicate a memory leak. The only way to
know for sure is to use a profiling tool.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='655' height='501' src="../images/screenshots/distribution_graph.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Aggregate_Graph"><h3>18.3.12 Aggregate Graph</h3></a>
</font>
</td></tr>
<tr><td>
The aggregate graph is similar to the aggregate report. The primary
difference is the aggregate graph provides an easy way to generate bar graphs and save
the graph as a PNG file. By default, the aggregate graph will generate a bar chart
450 x 250 pixels.
<p><b>Control Panel</b></p>
<div align="center"><img width='839' height='770' src="../images/screenshots/aggregate_graph.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Mailer_Visualizer"><h3>18.3.13 Mailer Visualizer</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The mailer visualizer can be set up to send email if a test run receives too many
failed responses from the server.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='645' height='345' src="../images/screenshots/mailervisualizer.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>From</td>
<td> Email address to send messages from.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Addressie(s)</td>
<td> Email address to send messages to.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>SMTP Host</td>
<td> IP address or host name of SMTP (email redirector)
server.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Failure Subject</td>
<td> Email subject line for fail messages.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Success Subject</td>
<td> Email subject line for success messages.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Failure Limit</td>
<td> Once this number of failed responses are received, a failure
email is sent.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Success Limit</td>
<td> Once this number of successful responses are
received
<strong >
after previously reaching the failure limit
</strong>
, a success email
is sent. The mailer will thus only send out messages in a sequence of failed-succeeded-failed-succeeded, etc.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Test Mail</td>
<td> Press this button to send a test mail
</td>
<td>
No
</td>
</tr>
<tr>
<td>Failures</td>
<td> A field that keeps a running total of number
of failures so far received.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="BeanShell_Listener"><h3>18.3.14 BeanShell Listener</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The BeanShell Listener allows the use of BeanShell for processing samples for saving etc.
</p>
<p >
<b >
Please note that the BeanShell jar file is not included with JMeter; it needs to be separately downloaded.
<br >
</br>
For full details on using BeanShell, please see the BeanShell web-site at http://www.beanshell.org/.
</b>
</p>
<p >
The test element supports the ThreadListener and TestListener methods.
These should be defined in the initialisation file.
See the file BeanShellListeners.bshrc for example definitions.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='597' height='303' src="../images/screenshots/beanshell_listener.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Reset bsh.Interpreter before each call</td>
<td>
If this option is selected, then the interpreter will be recreated for each sample.
This may be necessary for some long running scripts.
For further information, see
<a href="best-practices#bsh_scripting">
Best Practices - BeanShell scripting
</a>
.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Parameters</td>
<td> Parameters to pass to the BeanShell script.
The parameters are stored in the following variables:
<ul >
<li >
Parameters - string containing the parameters as a single variable
</li>
<li >
bsh.args - String array containing parameters, split on white-space
</li>
</ul>
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script file</td>
<td> A file containing the BeanShell script to run
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script</td>
<td> The BeanShell script to run. The return value is ignored.
</td>
<td>
Yes (unless script file is provided)
</td>
</tr>
</table>
</p>
<p >
The following variables are set up for use by the script:
</p>
<ul >
<li >
log - (Logger) - can be used to write to the log file
</li>
<li >
ctx - (JMeterContext) - gives access to the context
</li>
<li >
vars - (JMeterVariables) - gives read/write access to variables: vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());
</li>
<li >
sampleResult - (SampleResult) - gives access to the previous SampleResult
</li>
<li >
sampleEvent (SampleEvent) gives access to the current sample event
</li>
</ul>
<p >
For details of all the methods available on each of the above variables, please check the Javadoc
</p>
<p >
If the property
<b >
beanshell.listener.init
</b>
is defined, this is used to load an initialisation file, which can be used to define methods etc for use in the BeanShell script.
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Summary_Report"><h3>18.3.15 Summary Report</h3></a>
</font>
</td></tr>
<tr><td>
The summary report creates a table row for each differently named request in your
test. This is similar to the
<a href="../usermanual/component_reference.html#Aggregate_Report">Aggregate Report</a>
, except that it uses less memory.
<p >
The thoughput is calculated from the point of view of the sampler target
(e.g. the remote server in the case of HTTP samples).
JMeter takes into account the total time over which the requests have been generated.
If other samplers and timers are in the same thread, these will increase the total time,
and therefore reduce the throughput value.
So two identical samplers with different names will have half the throughput of two samplers with the same name.
It is important to choose the sampler labels correctly to get the best results from
the Report.
</p>
<ul >
<li >
Label - The label of the sample.
If "Include group name in label?" is selected, then the name of the thread group is added as a prefix.
This allows identical labels from different thread groups to be collated separately if required.
</li>
<li >
# Samples - The number of samples for the URL
</li>
<li >
Average - The average elapsed time of a set of results
</li>
<li >
Min - The lowest elapsed time for the samples of the given URL
</li>
<li >
Max - The longest elapsed time for the samples of the given URL
</li>
<li >
Std. Dev. - the standard deviation of the sample elapsed time
</li>
<li >
Error % - Percent of requests with errors
</li>
<li >
Throughput - Throughput measured in requests per second/minute/hour
</li>
<li >
Kb/sec - The throughput measured in Kilobytes per second
</li>
<li >
Avg. Bytes - average size of the sample response in bytes. (in JMeter 2.2 it wrongly showed the value in kB)
</li>
</ul>
<p >
Times are in milliseonds.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='784' height='287' src="../images/screenshots/summary_report.png"></div>
<div align="center">
<p >
The figure below shows an example of selecting the "Include group name" checkbox.
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/summary_report_grouped.png"><br>
<font size="-1"> Sample "Include group name" display
</font></td></tr></table></p>
</p>
</div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<a href="#">
^
</a>
</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="config_elements"><strong>18.4 Configuration Elements</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<description >
<br >
</br>
Configuration elements can be used to set up defaults and variables for later use by samplers.
Note that these elements are processed at the start of the scope in which they are found,
i.e. before any samplers in the same scope.
<br >
</br>
</description>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="CSV_Data_Set_Config"><h3>18.4.1 CSV Data Set Config</h3></a>
</font>
</td></tr>
<tr><td>
<p >
CSV Data Set Config is used to read lines from a file, and split them into variables.
It is easier to use than the __CSVRead() and _StringFromFile() functions.
Versions of JMeter after 2.3.1 allow variables to be quoted; this allows the value to contain a delimiter.
Previously it was necessary to choose a delimiter that was not used in any values.
</p>
<p >
The file is only opened once, and each thread will use a different line from the file.
Lines are read as the threads need them.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> CSV Dataset variables are defined after configuration processing is completed,
so they cannot be used for some configuration items - such as JDBC Config -
that process their contents at configuration time (see
<a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=40934">
Bug 40394
</a>
)
However the variables do work in the HTTP Auth Manager, as the username etc are processed at run-time.
</td></tr>
</table></p>
<p >
As a special case, the string "\t" (without quotes) in the delimiter field is treated as a Tab.
</p>
<p >
When the end of file (EOF) is reached, and the recycle option is true, reading starts again with the first line of the file.
</p>
<p >
If the recycle option is false, and stopThread is false, then all the variables are set to
<b >
&lt;EOF>
</b>
when the end of file is reached.
This value can be changed by setting the JMeter property
<b >
csvdataset.eofstring
</b>
.
</p>
<p >
If the Recycle option is false, and Stop Thread is true, then reaching EOF will cause the thread to be stopped.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='308' height='278' src="../images/screenshots/csvdatasetconfig.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Filename</td>
<td> Name of the file to be read.
<b >
Relative file names are resolved with respect to the path of the active test plan.
</b>
Absolute file names are also supported, but note that they are unlikely to work in remote mode,
unless the remote server has the same directory structure.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>File Encoding</td>
<td> The encoding to be used to read the file, if not the platform default.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Variable Names</td>
<td> List of variable names (comma-delimited)
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Delimiter</td>
<td> Delimiter to be used to split the records in the file.
If there are fewer values on the line than there are variables the remaining variables are not updated -
so they will retain their previous value (if any).
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Allow quoted data?</td>
<td> Should the CSV file allow values to be quoted?
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Recycle on EOF?</td>
<td> Should the file be re-read from the beginning on reaching EOF? (default is true)
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Stop thread on EOF?</td>
<td> Should the thread be stopped on EOF, if Recycle is false? (default is false)
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="FTP_Request_Defaults"><h3>18.4.2 FTP Request Defaults</h3></a>
</font>
</td></tr>
<tr><td>
<p><b>Control Panel</b></p>
<div align="center"><img width='490' height='198' src="../images/screenshots/ftp-config/ftp-request-defaults.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTTP_Authorization_Manager"><h3>18.4.3 HTTP Authorization Manager</h3></a>
</font>
</td></tr>
<tr><td>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> If there is more than one Authorization Manager in the scope of a Sampler,
there is currently no way to sepcify which one is to be used.
</td></tr>
</table></p>
<p >
The Authorization Manager lets you specify one or more user logins for web pages that are
restricted using server authentication. You see this type of authentication when you use
your browser to access a restricted page, and your browser displays a login dialog box. JMeter
transmits the login information when it encounters this type of page.
</p>
<p >
In versions of JMeter after 2.2, the HttpClient sampler defaults to pre-emptive authentication
if the setting has not been defined. To disable this, set the values as below, in which case
authentication will only be performed in response to a challenge.
<pre >
jmeter.properties:
httpclient.parameters.file=httpclient.parameters
httpclient.parameters:
http.authentication.preemptive$Boolean=false
</pre>
Note: the above settings only apply to the HttpClient sampler (and the SOAP samplers, which use Httpclient).
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
When looking for a match against a URL, JMeter checks each entry in turn, and stops when it finds the first match.
Thus the most specific URLs should appear first in the list, followed by less specific ones.
Duplicate URLs will be ignored.
If you want to use different usernames/passwords for different threads, you can use variables.
These can be set up using a
<a href="../usermanual/component_reference.html#CSV_Data_Set_Config">CSV Data Set Config</a>
Element (for example).
</td></tr>
</table></p>
<p><b>Control Panel</b></p>
<div align="center"><img width='490' height='253' src="../images/screenshots/http-config/http-auth-manager.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Base URL</td>
<td> A partial or complete URL that matches one or more HTTP Request URLs. As an example,
say you specify a Base URL of "http://jakarta.apache.org/restricted/" with a username of "jmeter" and
a password of "jmeter". If you send an HTTP request to the URL
"http://jakarta.apache.org/restricted/ant/myPage.html", the Authorization Manager sends the login
information for the user named, "jmeter".
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Username</td>
<td> The username to authorize.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Password</td>
<td> The password for the user.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Domain</td>
<td> The domain to use for NTLM.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Realm</td>
<td> The realm to use for NTLM.
</td>
<td>
No
</td>
</tr>
</table>
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
The Realm only applies to the HttpClient sampler.
In JMeter 2.2, the domain and realm did not have separate columns, and were encoded as part of
the user name in the form: [domain\]username[@realm].
This was an experimental feature and has been removed.
</td></tr>
</table></p>
<b >
Controls:
</b>
<ul >
<li >
Add Button - Add an entry to the authorization table.
</li>
<li >
Delete Button - Delete the currently selected table entry.
</li>
<li >
Load Button - Load a previously saved authorization table and add the entries to the existing
authorization table entries.
</li>
<li >
Save As Button - Save the current authorization table to a file.
</li>
</ul>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> When you save the Test Plan, JMeter automatically saves all of the authorization
table entries - including any passwords, which are not encrypted.
</td></tr>
</table></p>
<a name="authorization_example"/>
<p><b>Authorization Example</b></p>
<p >
<a href="../demos/AuthManagerTestPlan.jmx">
Download
</a>
this example. In this example, we created a Test Plan on a local server that sends three HTTP requests, two requiring a login and the
other is open to everyone. See figure 10 to see the makeup of our Test Plan. On our server, we have a restricted
directory named, "secret", which contains two files, "index.html" and "index2.html". We created a login id named, "kevin",
which has a password of "spot". So, in our Authorization Manager, we created an entry for the restricted directory and
a username and password (see figure 11). The two HTTP requests named "SecretPage1" and "SecretPage2" make requests
to "/secret/index.html" and "/secret/index2.html". The other HTTP request, named "NoSecretPage" makes a request to
"/index.html".
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/http-config/auth-manager-example1a.gif"><br>
<font size="-1"> Figure 10 - Test Plan
</font></td></tr></table></p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/http-config/auth-manager-example1b.png"><br>
<font size="-1"> Figure 11 - Authorization Manager Control Panel
</font></td></tr></table></p>
<p >
When we run the Test Plan, JMeter looks in the Authorization table for the URL it is requesting. If the Base URL matches
the URL, then JMeter passes this information along with the request.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> You can download the Test Plan, but since it is built as a test for our local server, you will not
be able to run it. However, you can use it as a reference in constructing your own Test Plan.
</td></tr>
</table></p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTTP_Cookie_Manager"><h3>18.4.4 HTTP Cookie Manager</h3></a>
</font>
</td></tr>
<tr><td>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> If there is more than one Cookie Manager in the scope of a Sampler,
there is currently no way to specify which one is to be used.
</td></tr>
</table></p>
<p >
The Cookie Manager element has two functions:
<br >
</br>
First, it stores and sends cookies just like a web browser. If you have an HTTP Request and
the response contains a cookie, the Cookie Manager automatically stores that cookie and will
use it for all future requests to that particular web site. Each JMeter thread has its own
"cookie storage area". So, if you are testing a web site that uses a cookie for storing
session information, each JMeter thread will have its own session.
</p>
<p >
Received Cookies are stored as JMeter thread variables.
Thus the value of a cookie with the name TEST can be referred to as ${TEST}
</p>
<p >
Second, you can manually add a cookie to the Cookie Manager. However, if you do this,
the cookie will be shared by all JMeter threads.
</p>
<p >
Note that such Cookies are created with an Expiration time far in the future
</p>
<p >
Since version 2.0.3, cookies with null values are ignored by default.
This can be changed by setting the JMeter property: CookieManager.delete_null_cookies=false.
Note that this also applies to manually defined cookies - any such cookies will be removed from the display when it is updated.
Note also that the cookie name must be unique - if a second cookie is defined with the same name, it will replace the first.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='548' height='319' src="../images/screenshots/http-config/http-cookie-manager.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Clear Cookies each Iteration</td>
<td> If selected, all server-defined cookies are cleared each time the main Thread Group loop is executed.
In JMeter versions after 2.3, any cookies defined in the GUI are not cleared.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Cookie Policy</td>
<td> The cookie policy that will be used to manage the cookies.
"compatibility" is the default, and should work in most cases.
See http://jakarta.apache.org/httpcomponents/httpclient-3.x/cookies.html and
http://jakarta.apache.org/httpcomponents/httpclient-3.x/apidocs/org/apache/commons/httpclient/cookie/CookiePolicy.html
[Note: "ignoreCookies" is equivalent to omitting the CookieManager.]
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Cookies Stored in the Cookie Manager</td>
<td> This
gives you the opportunity to use hardcoded cookies that will be used by all threads during the test execution.
<br >
</br>
The "domain" is the hostname of the server (without http://); the port is currently ignored.
</td>
<td>
No (discouraged, unless you know what you're doing)
</td>
</tr>
<tr>
<td>Add Button</td>
<td> Add an entry to the cookie table.
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>Delete Button</td>
<td> Delete the currently selected table entry.
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>Load Button</td>
<td> Load a previously saved cookie table and add the entries to the existing
cookie table entries.
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>Save As Button</td>
<td>
Save the current cookie table to a file (does not save any cookies extracted from HTTP Responses).
</td>
<td>
N/A
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTTP_Request_Defaults"><h3>18.4.5 HTTP Request Defaults</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This element lets you set default values that your HTTP Request controllers use. For example, if you are
creating a Test Plan with 25 HTTP Request controllers and all of the requests are being sent to the same server,
you could add a single HTTP Request Defaults element with the "Server Name or IP" field filled in. Then, when
you add the 25 HTTP Request controllers, leave the "Server Name or IP" field empty. The controllers will inherit
this field value from the HTTP Request Defaults element.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
In JMeter 2.2 and earlier, port 80 was treated specially - it was ignored if the sampler used the https protocol.
JMeter 2.3 and later treat all port values equally; a sampler that does not specify a port will use the HTTP Request Defaults port, if one is provided.
</td></tr>
</table></p>
<p><b>Control Panel</b></p>
<div align="center"><img width='581' height='385' src="../images/screenshots/http-config/http-request-defaults.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Server</td>
<td> Domain name or IP address of the web server. e.g. www.example.com. [Do not include the http:// prefix.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Port</td>
<td> Port the web server is listening to.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Protocol</td>
<td> HTTP or HTTPS.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Method</td>
<td> HTTP GET or HTTP POST.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Path</td>
<td> The path to resource (for example, /servlets/myServlet). If the
resource requires query string parameters, add them below in the "Send Parameters With the Request" section.
Note that the path is the default for the full path, not a prefix to be applied to paths
specified on the HTTP Request screens.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Send Parameters With the Request</td>
<td> The query string will
be generated from the list of parameters you provide. Each parameter has a
<i >
name
</i>
and
<i >
value
</i>
. The query string will be generated in the correct fashion, depending on
the choice of "Method" you made (ie if you chose GET, the query string will be
appended to the URL, if POST, then it will be sent separately). Also, if you are
sending a file using a multipart form, the query string will be created using the
multipart form specifications.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTTP_Header_Manager"><h3>18.4.6 HTTP Header Manager</h3></a>
</font>
</td></tr>
<tr><td>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> If there is more than one Header Manager in the scope of a Sampler,
there is currently no way to sepcify which one is to be used.
</td></tr>
</table></p>
<p >
The Header Manager lets you add or override HTTP request headers.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img src="../images/screenshots/http-config/http-header-manager.gif"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Name (Header)</td>
<td> Name of the request header.
Two common request headers you may want to experiment with
are "User-Agent" and "Referer".
</td>
<td>
No (You should have at least one, however)
</td>
</tr>
<tr>
<td>Value</td>
<td> Request header value.
</td>
<td>
No (You should have at least one, however)
</td>
</tr>
<tr>
<td>Add Button</td>
<td> Add an entry to the header table.
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>Delete Button</td>
<td> Delete the currently selected table entry.
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>Load Button</td>
<td> Load a previously saved header table and add the entries to the existing
header table entries.
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>Save As Button</td>
<td> Save the current header table to a file.
</td>
<td>
N/A
</td>
</tr>
</table>
</p>
<a name="header_manager_example"/>
<p><b>Header Manager example</b></p>
<p >
<a href="../demos/HeaderManagerTestPlan.jmx">
Download
</a>
this example. In this example, we created a Test Plan
that tells JMeter to override the default "User-Agent" request header and use a particular Internet Explorer agent string
instead. (see figures 9 and 10).
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/http-config/header-manager-example1a.gif"><br>
<font size="-1"> Figure 12 - Test Plan
</font></td></tr></table></p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/http-config/header-manager-example1b.gif"><br>
<font size="-1"> Figure 13 - Header Manager Control Panel
</font></td></tr></table></p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Java_Request_Defaults"><h3>18.4.7 Java Request Defaults</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Java Request Defaults component lets you set default values for Java testing. See the
<a href="../usermanual/component_reference.html#Java_Request">Java Request</a>
.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='454' height='283' src="../images/screenshots/java_defaults.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="JDBC_Connection_Configuration"><h3>18.4.8 JDBC Connection Configuration</h3></a>
</font>
</td></tr>
<tr><td>
Creates a database connection pool (used by
<a href="../usermanual/component_reference.html#JDBC_Request">JDBC Request</a>
Sampler)
with JDBC Connection settings.
<p><b>Control Panel</b></p>
<div align="center"><img width='369' height='443' src="../images/screenshots/jdbc-config/jdbc-conn-config.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for the connection pool that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Variable Name</td>
<td> The name of the variable the connection pool is tied to.
Multiple connection pools can be used, each tied to a different variable, allowing JDBC Samplers
to select the pool to draw connections from.
<b >
Each pool name must be different. If there are two configuration elements using the same pool name,
only one will be saved. JMeter versions after 2.3 log a message if a duplicate name is detected.
</b>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Max Number of Connections</td>
<td> Maximum number of connections allowed in the pool.
To ensure that threads don't have to wait for connections, set the max count to the same as the number of threads.
In versions of JMeter after 2.3, the value "0" is treated specially.
Instead of sharing the pool between all threads in the test plan, a pool containing a single connection
is created for each thread. This ensures that the same connection can be re-used for multiple samplers
in the same thread.
Multiple such pools can be used - e.g. for connecting to different databases - just give them different names.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Pool timeout</td>
<td> Pool throws an error if the timeout period is exceeded in the
process of trying to retrieve a connection
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Idle Cleanup Interval (ms)</td>
<td> Uncertain what exactly this does.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Auto Commit</td>
<td> Turn auto commit on or off for the connections.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Keep-alive</td>
<td> Uncertain what exactly this does.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Max Connection Age (ms)</td>
<td> Uncertain what exactly this does.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Validation Query</td>
<td> A simple query used to determine if the database is still
responding.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Database URL</td>
<td> JDBC Connection string for the database.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>JDBC Driver class</td>
<td> Fully qualified name of driver class. (Must be in
JMeter's classpath - easiest to copy .jar file into JMeter's /lib directory).
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Username</td>
<td> Name of user to connect as.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Password</td>
<td> Password to connect with.
</td>
<td>
No
</td>
</tr>
</table>
</p>
<p >
Different databases and JDBC drivers require different JDBC settings.
The Database URL and JDBC Driver class are defined by the provider of the JDBC implementation.
</p>
<p >
Some possible settings are shown below. Please check the exact details in the JDBC driver documentation.
</p>
<table>
<tr>
<td bgcolor="#039acc" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Database
</font>
</td>
<td bgcolor="#039acc" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Driver class
</font>
</td>
<td bgcolor="#039acc" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Database URL
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
MySQL
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
com.mysql.jdbc.Driver
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
jdbc:mysql://host[:port]/dbname
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
PostgreSQL
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
org.postgresql.Driver
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
jdbc:postgresql:{dbname}
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Oracle
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
oracle.jdbc.driver.OracleDriver
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
jdbc:oracle:thin:user/pass@//host:port/service
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Ingres (2006)
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
ingres.jdbc.IngresDriver
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
jdbc:ingres://host:port/db[;attr=value]
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
SQL Server (MS JDBC driver)
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
com.microsoft.sqlserver.jdbc.SQLServerDriver
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
jdbc:sqlserver://host:port;DatabaseName=dbname
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Apache Derby
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
org.apache.derby.jdbc.ClientDriver
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
jdbc:derby://server[:port]/databaseName[;URLAttributes=value[;...]]
</font>
</td>
</tr>
</table>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> The above may not be correct - please check the relevant JDBC driver documentation.
</td></tr>
</table></p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Login_Config_Element"><h3>18.4.9 Login Config Element</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Login Config Element lets you add or override username and password settings in samplers that use username and password as part of their setup.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='352' height='112' src="../images/screenshots/login-config.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Username</td>
<td> The default username to use.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Password</td>
<td> The default password to use.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="LDAP_Request_Defaults"><h3>18.4.10 LDAP Request Defaults</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The LDAP Request Defaults component lets you set default values for LDAP testing. See the
<a href="../usermanual/component_reference.html#LDAP_Request">LDAP Request</a>
.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='465' height='375' src="../images/screenshots/ldap_defaults.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="LDAP_Extended_Request_Defaults"><h3>18.4.11 LDAP Extended Request Defaults</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The LDAP Extended Request Defaults component lets you set default values for extended LDAP testing. See the
<a href="../usermanual/component_reference.html#LDAP_Extended_Request">LDAP Extended Request</a>
.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='597' height='545' src="../images/screenshots/ldapext_defaults.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="TCP_Sampler_Config"><h3>18.4.12 TCP Sampler Config</h3></a>
</font>
</td></tr>
<tr><td>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> ALPHA CODE
</td></tr>
</table></p>
<p >
The TCP Sampler Config provides default data for the TCP Sampler
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='645' height='256' src="../images/screenshots/tcpsamplerconfig.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>ServerName or IP</td>
<td> Name or IP of TCP server
</td>
<td>
No
</td>
</tr>
<tr>
<td>Port Number</td>
<td> Port to be used
</td>
<td>
No
</td>
</tr>
<tr>
<td>Timeout (milliseconds)</td>
<td> Timeout for replies
</td>
<td>
No
</td>
</tr>
<tr>
<td>Set Nodelay</td>
<td> Should the nodelay property be set?
</td>
<td>
No
</td>
</tr>
<tr>
<td>Text to Send</td>
<td> Text to be sent
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="User_Defined_Variables"><h3>18.4.13 User Defined Variables</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The User Defined Variables lets you define variables for use in other test elements, just as in the
<a href="../usermanual/component_reference.html#Test_Plan">Test Plan</a>
.
The variables in User Defined Variables components will take precedence over those defined closer to the tree root -- including those defined in the Test Plan.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='690' height='394' src="../images/screenshots/user_defined_variables.png"></div>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
If you have more than one Thread Group, make sure you use different names for different values, as UDVs are shared between Thread Groups.
Also, the variables are not available for use until after the element has been processed,
so you cannot use variables that are defined in the same element.
You can use variables defined in earlier UDVs or on the Test Plan.
</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>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>User Defined Variables</td>
<td> Variable name/value pairs. The string under the "Name"
column is what you'll need to place inside the brackets in ${...} constructs to use the variables later on. The
whole ${...} will then be replaced by the string in the "Value" column.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Simple_Config_Element"><h3>18.4.14 Simple Config Element</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Simple Config Element lets you add or override arbitrary values in samplers. You can choose the name of the value
and the value itself. Although some adventurous users might find a use for this element, it's here primarily for developers as a basic
GUI that they can use while developing new JMeter components.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='393' height='245' src="../images/screenshots/simple_config_element.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Parameter Name</td>
<td> The name of each parameter. These values are internal to JMeter's workings and
are not generally documented. Only those familiar with the code will know these values.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Parameter Value</td>
<td> The value to apply to that parameter.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<a href="#">
^
</a>
</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="assertions"><strong>18.5 Assertions</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<description >
<br >
</br>
Assertions are used to perform additional checks on samplers, and are processed after
<b >
each sampler
</b>
in the same scope.
<br >
</br>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
The variable
<b >
JMeterThread.last_sample_ok
</b>
is set to
"true" or "false" after all assertions for a sampler have been run.
</td></tr>
</table></p>
</description>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Response_Assertion"><h3>18.5.1 Response Assertion</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The response assertion control panel lets you add pattern strings to be compared against various
fields of the response.
The pattern strings are Perl5-style regular expressions.
</p>
<p >
A summary of the pattern matching characters can be found at
<a href="http://jakarta.apache.org/oro/api/org/apache/oro/text/regex/package-summary.html">
http://jakarta.apache.org/oro/api/org/apache/oro/text/regex/package-summary.html
</a>
</p>
<p >
You can also choose whether the strings will be expected
to
<b >
match
</b>
the entire response, or if the response is only expected to
<b >
contain
</b>
the
pattern. You can attach multiple assertions to any controller for additional flexibility.
</p>
<p >
Note that the pattern string should not include the enclosing delimiters,
i.e. use
<b >
Price: \d+
</b>
not
<b >
/Price: \d+/
</b>
.
</p>
<p >
By default, the pattern is in multi-line mode, which means that the "." meta-character does not match newline.
In multi-line mode, "^" and "$" match the start or end of any line anywhere within the string
- not just the start and end of the entire string. Note that \s does match new-line.
Case is also significant. To override these settings, one can use the extended regular expression syntax.
For example:
</p>
<pre >
(?i) - ignore case
(?s) - treat target as single line, i.e. "." matches new-line
(?is) - both the above
These can be used anywhere within the expression, e.g.
(?i)apple(?-i) Pie - matches "ApPLe Pie", but not "ApPLe pIe"
</pre>
<p><b>Control Panel</b></p>
<div align="center"><img width='762' height='374' src="../images/screenshots/assertion/assertion.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Response Field to Test</td>
<td> Instructs JMeter which field of the Response to test.
This may be the Response Text from the server, the URL string that was sampled,
the Response Headers (JMeter version 2.3RC3 and earlier included the headers with the Text),
the Response Code (e.g. 404) or the Response Message (e.g. Not Found).
<p >
The overall success of the sample is determined by combining the result of the
assertion with the existing Response status.
When the Ignore Status checkbox is selected, the Response status is forced
to successful before evaluating the Assertion.
</p>
HTTP Responses with statuses in the 4xx and 5xx ranges are normally
regarded as unsuccessful.
The "Ignore status" checkbox can be used to set the status successful before performing further checks.
Note that this will have the effect of clearing any previous assertion failures,
so make sure that this is only set on the first assertion.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Pattern Matching Rules</td>
<td> Indicates how the text being tested
is checked against the pattern.
<ul >
<li >
Contains - true if the text contains the regular expression pattern
</li>
<li >
Matches - true if the whole text matches the regular expression pattern
</li>
<li >
Equals - true if the whole text equals the pattern string (case-sensitive)
</li>
<li >
Substring - true if the text contains the pattern string (case-sensitive)
</li>
</ul>
NOT may also be selected to invert the result of the check.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Patterns to Test</td>
<td> A list of patterns to
be tested.
Each pattern is tested separately.
If a pattern fails, then further patterns are not checked.
There is no difference between setting up
one Assertion with multiple patterns and setting up multiple Assertions with one
pattern each (assuming the other options are the same).
<b >
However, when the Ignore Status checkbox is selected, this has the effect of cancelling any
previous assertion failures - so make sure that the Ignore Status checkbox is only used on
the first Assertion.
</b>
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
<p >
The pattern is a Perl5-style regular expression, but without the enclosing brackets.
</p>
<a name="assertion_examples"/>
<p><b>Assertion Examples</b></p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/assertion/example1a.png"><br>
<font size="-1"> Figure 14 - Test Plan
</font></td></tr></table></p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/assertion/example1b.png"><br>
<font size="-1"> Figure 15 - Assertion Control Panel with Pattern
</font></td></tr></table></p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/assertion/example1c-pass.gif"><br>
<font size="-1"> Figure 16 - Assertion Listener Results (Pass)
</font></td></tr></table></p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/assertion/example1c-fail.gif"><br>
<font size="-1"> Figure 17 - Assertion Listener Results (Fail)
</font></td></tr></table></p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Duration_Assertion"><h3>18.5.2 Duration Assertion</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Duration Assertion tests that each response was received within a given amount
of time. Any response that takes longer than the given number of milliseconds (specified by the
user) is marked as a failed response.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='391' height='147' src="../images/screenshots/duration_assertion.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Duration in Milliseconds</td>
<td> The maximum number of milliseconds
each response is allowed before being marked as failed.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Size_Assertion"><h3>18.5.3 Size Assertion</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Size Assertion tests that each response contains the right number of bytes in it. You can specify that
the size be equal to, greater than, less than, or not equal to a given number of bytes.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> Since JMeter 2.3RC3, an empty response is treated as being 0 bytes rather than reported as an error.
</td></tr>
</table></p>
<p><b>Control Panel</b></p>
<div align="center"><img width='331' height='346' src="../images/screenshots/size_assertion.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Size in bytes</td>
<td> The number of bytes to use in testing the size of the response.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Type of Comparison</td>
<td> Whether to test that the response is equal to, greater than, less than,
or not equal to, the number of bytes specified.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="XML_Assertion"><h3>18.5.4 XML Assertion</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The XML Assertion tests that the response data consists of a formally correct XML document. It does not
validate the XML based on a DTD or schema or do any further validation.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='303' height='196' src="../images/screenshots/xml_assertion.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="BeanShell_Assertion"><h3>18.5.5 BeanShell Assertion</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The BeanShell Assertion allows the user to perform assertion checking using a BeanShell script.
</p>
<p >
<b >
Please note that the BeanShell jar file is not included with JMeter;
it needs to be downloaded separately and placed in the lib directory.
<br >
</br>
For full details on using BeanShell, please see the BeanShell web-site at http://www.beanshell.org/.
</b>
</p>
<p >
Note that a different Interpreter is used for each independent occurence of the assertion
in each thread in a test script, but the same Interpreter is used for subsequent invocations.
This means that variables persist across calls to the assertion.
</p>
<p >
All Assertions are called from the same thread as the sampler.
</p>
<p >
If the property "beanshell.assertion.init" is defined, it is passed to the Interpreter
as the name of a sourced file. This can be used to define common methods and variables.
There is a sample init file in the bin directory: BeanShellAssertion.bshrc
</p>
<p >
The test element supports the ThreadListener and TestListener methods.
These should be defined in the initialisation file.
See the file BeanShellListeners.bshrc for example definitions.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='597' height='303' src="../images/screenshots/bsh_assertion.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Reset bsh.Interpreter before each call</td>
<td>
If this option is selected, then the interpreter will be recreated for each sample.
This may be necessary for some long running scripts.
For further information, see
<a href="best-practices#bsh_scripting">
Best Practices - BeanShell scripting
</a>
.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Parameters</td>
<td> Parameters to pass to the BeanShell script.
The parameters are stored in the following variables:
<ul >
<li >
Parameters - string containing the parameters as a single variable
</li>
<li >
bsh.args - String array containing parameters, split on white-space
</li>
</ul>
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script file</td>
<td> A file containing the BeanShell script to run. This overrides the script.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script</td>
<td> The BeanShell script to run. The return value is ignored.
</td>
<td>
Yes (unless script file is provided)
</td>
</tr>
</table>
</p>
<p >
There's a
<a href="../demos/BeanShellAssertion.bsh">
sample script
</a>
you can try.
</p>
<p >
The following variables are defined to the script.
These are strings unless otherwise noted:
<ul >
<li >
log - the Logger Object. (e.g.) log.warn("Message"[,Throwable])
</li>
<li >
SampleResult - the SampleResult Object; read-write
</li>
<li >
Response - the response Object; read-write
</li>
<li >
Failure - boolean; read-write; used to set the Assertion status
</li>
<li >
FailureMessage - String; read-write; used to set the Assertion message
</li>
<li >
ResponseData - the response body (byte [])
</li>
<li >
ResponseCode - e.g. 200
</li>
<li >
ResponseMessage - e.g. OK
</li>
<li >
ResponseHeaders - contains the HTTP headers
</li>
<li >
RequestHeaders - contains the HTTP headers sent to the server
</li>
<li >
SampleLabel
</li>
<li >
SamplerData - data that was sent to the server
</li>
<li >
ctx - JMeterContext
</li>
<li >
vars - JMeterVariables - e.g. vars.get("VAR1"); vars.put("VAR2","value"); vars.putObject("OBJ1",new Object());
</li>
</ul>
</p>
<p >
The following methods of the Response object may be useful:
<ul >
<li >
setStopThread(boolean)
</li>
<li >
setStopTest(boolean)
</li>
<li >
String getSampleLabel()
</li>
<li >
setSampleLabel(String)
</li>
</ul>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="MD5Hex_Assertion"><h3>18.5.6 MD5Hex Assertion</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The MD5Hex Assertion allows the user to check the MD5 hash of the response data.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='411' height='149' src="../images/screenshots/assertion/MD5HexAssertion.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>MD5 sum</td>
<td> 32 hex digits representing the MD5 hash (case not significant)
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTML_Assertion"><h3>18.5.7 HTML Assertion</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The HTML Assertion allows the user to check the HTML syntax of the response data using JTidy.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='464' height='384' src="../images/screenshots/assertion/HTMLAssertion.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>doctype</td>
<td> omit/auto/strict/loose
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Format</td>
<td> HTML, XHTML or XML
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Errors only</td>
<td> Only take note of errors?
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Error threshold</td>
<td> Number of errors allowed before classing the response as failed
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Warning threshold</td>
<td> Number of warnings allowed before classing the response as failed
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Filename</td>
<td> Name of file to which report is written
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="XPath_Assertion"><h3>18.5.8 XPath Assertion</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The XPath Assertion tests a document for well formedness, has the option
of validating against a DTD, or putting the document through JTidy and testing for an
XPath. If that XPath exists, the Assertion is true. Using "/" will match any well-formed
document, and is the default XPath Expression.
The assertion also supports boolean expressions, such as "count(//*error)=2".
See
<a href="http://www.w3.org/TR/xpath">
http://www.w3.org/TR/xpath
</a>
for more information
on XPath.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='872' height='266' src="../images/screenshots/xpath_assertion.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Tolerant Parser</td>
<td> Be tolerant of XML/HTML errors (i.e. use Tidy)
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Quiet</td>
<td> Sets the Tidy Quiet flag
</td>
<td>
If tolerant is selected
</td>
</tr>
<tr>
<td>Report Errors</td>
<td> If a Tidy error occurs, then set the Assertion accordingly
</td>
<td>
If tolerant is selected
</td>
</tr>
<tr>
<td>Show warnings</td>
<td> Sets the Tidy showWarnings option
</td>
<td>
If tolerant is selected
</td>
</tr>
<tr>
<td>Use Namespaces</td>
<td> Should namespaces be honoured?
</td>
<td>
No
</td>
</tr>
<tr>
<td>Validate XML</td>
<td> Check the document against its schema.
</td>
<td>
No
</td>
</tr>
<tr>
<td>XPath Assertion</td>
<td> XPath to match in the document.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Ignore Whitespace</td>
<td> Ignore Element Whitespace.
</td>
<td>
No
</td>
</tr>
<tr>
<td>True if nothing matches</td>
<td> True if a XPath expression is not matched
</td>
<td>
No
</td>
</tr>
</table>
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
The non-tolerant parser can be quite slow, as it may need to download the DTD etc.
</td></tr>
</table></p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="XML_Schema_Assertion"><h3>18.5.9 XML Schema Assertion</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The XML Schema Assertion allows the user to validate a response against an XML Schema.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='771' height='171' src="../images/screenshots/assertion/XMLSchemaAssertion.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>File Name</td>
<td> Specify XML Schema File Name
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<a href="#">
^
</a>
</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="timers"><strong>18.6 Timers</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<description >
<br >
</br>
<p >
Note that timers are processed
<b >
before
</b>
each sampler in the scope in which they are found;
if there are several timers in the same scope,
<b >
all
</b>
the timers will be processed
<b >
before
each
</b>
sampler.
<br >
</br>
Timers are only processed in conjunction with a sampler.
A timer which is not in the same scope as a sampler will not be processed at all.
<br >
</br>
To apply a timer to a single sampler, add the timer as a child element of the sampler.
The timer will be applied before the sampler is executed.
To apply a timer after a sampler, either add it to the next sampler, or add it as the
child of a
<a href="../usermanual/component_reference.html#Test_Action">Test Action</a>
Sampler.
</p>
</description>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Constant_Timer"><h3>18.6.1 Constant Timer</h3></a>
</font>
</td></tr>
<tr><td>
<p >
If you want to have each thread pause for the same amount of time between
requests, use this timer.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='390' height='100' src="../images/screenshots/timers/constant_timer.gif"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this timer that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Thread Delay</td>
<td> Number of milliseconds to pause.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Gaussian_Random_Timer"><h3>18.6.2 Gaussian Random Timer</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This timer pauses each thread request for a random amount of time, with most
of the time intervals ocurring near a particular value. The total delay is the
sum of the Gaussian distributed value (with mean 0.0 and standard deviation 1.0) times
the deviation value you specify, and the offset value.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='390' height='182' src="../images/screenshots/timers/gauss_random_timer.gif"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this timer that is shown in the tree
</td>
<td>
No
</td>
</tr>
<tr>
<td>Deviation</td>
<td> Deviation in milliseconds.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Constant Delay Offset</td>
<td> Number of milliseconds to pause in addition
to the random delay.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Uniform_Random_Timer"><h3>18.6.3 Uniform Random Timer</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This timer pauses each thread request for a random amount of time, with
each time interval having the same probability of occurring. The total delay
is the sum of the random value and the offset value.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='390' height='182' src="../images/screenshots/timers/uniform_random_timer.gif"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this timer that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Random Delay Maximum</td>
<td> Maxium random number of milliseconds to
pause.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Constant Delay Offset</td>
<td> Number of milliseconds to pause in addition
to the random delay.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Constant_Throughput_Timer"><h3>18.6.4 Constant Throughput Timer</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This timer introduces variable pauses, calculated to keep the total throughput (in terms of samples per minute) as close as possible to a give figure. Of course the throughput will be lower if the server is not capable of handling it, or if other timers or time-consuming test elements prevent it.
</p>
<p >
N.B. although the Timer is called the Constant Throughput timer, the throughput value does not need to be constant.
It can be defined in terms of a variable or function call, and the value can be changed during a test.
The value can be changed in various ways:
</p>
<ul >
<li >
using a counter variable
</li>
<li >
using a JavaScript or BeanShell function to provide a changing value
</li>
<li >
using the remote BeanShell server to change a JMeter property
</li>
</ul>
<p >
See
<a href="best-practices.html">
Best Practices
</a>
for further details.
Note that the throughput value should not be changed too often during a test
- it will take a while for the new value to take effect.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='542' height='155' src="../images/screenshots/timers/constant_throughput_timer.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this timer that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Target Throughput</td>
<td> Throughput we want the timer to try to generate.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Calculate Throughput based on</td>
<td>
<ul >
<li >
this thread only - each thread will try to maintain the target throughput. The overall throughput will be proportional to the number of active threads.
</li>
<li >
all active threads in current thread group - the target throughput is divided amongst all the active threads in the group.
Each thread will delay as needed, based on when it last ran.
</li>
<li >
all active threads - the target throughput is divided amongst all the active threads in all Thread Groups.
Each thread will delay as needed, based on when it last ran.
In this case, each other Thread Group will need a Constant Throughput timer with the same settings.
</li>
<li >
all active threads in current thread group (shared) - as above, but each thread is delayed based on when any thread in the group last ran.
</li>
<li >
all active threads (shared) - as above; each thread is delayed based on when any thread last ran.
</li>
</ul>
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Synchronizing_Timer"><h3>18.6.5 Synchronizing Timer</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The purpose of the SyncTimer is to block threads until X number of threads have been blocked, and
then they are all released at once. A SyncTimer can thus create large instant loads at various
points of the test plan.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='335' height='146' src="../images/screenshots/timers/sync_timer.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this timer that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Number of Simultaneous Users to Group by</td>
<td> Number of threads to release at once.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="BeanShell_Timer"><h3>18.6.6 BeanShell Timer</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The BeanShell Timer can be used to generate a delay.
</p>
<p >
<b >
Please note that the BeanShell jar file is not included with JMeter; it needs to be separately downloaded.
<br >
</br>
For full details on using BeanShell, please see the BeanShell web-site at http://www.beanshell.org/.
</b>
</p>
<p >
The test element supports the ThreadListener and TestListener methods.
These should be defined in the initialisation file.
See the file BeanShellListeners.bshrc for example definitions.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='516' height='286' src="../images/screenshots/timers/beanshell_timer.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Reset bsh.Interpreter before each call</td>
<td>
If this option is selected, then the interpreter will be recreated for each sample.
This may be necessary for some long running scripts.
For further information, see
<a href="best-practices#bsh_scripting">
Best Practices - BeanShell scripting
</a>
.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Parameters</td>
<td> Parameters to pass to the BeanShell script.
The parameters are stored in the following variables:
<ul >
<li >
Parameters - string containing the parameters as a single variable
</li>
<li >
bsh.args - String array containing parameters, split on white-space
</li>
</ul>
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script file</td>
<td>
A file containing the BeanShell script to run.
The return value is used as the number of milliseconds to wait.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script</td>
<td>
The BeanShell script. The return value is used as the number of milliseconds to wait.
</td>
<td>
Yes (unless script file is provided)
</td>
</tr>
</table>
</p>
<p >
The following variables are set up for use by the script:
</p>
<ul >
<li >
log - (Logger) - can be used to write to the log file
</li>
<li >
ctx - (JMeterContext) - gives access to the context
</li>
<li >
vars - (JMeterVariables) - gives read/write access to variables: vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());
</li>
</ul>
<p >
For details of all the methods available on each of the above variables, please check the Javadoc
</p>
<p >
If the property
<b >
beanshell.timer.init
</b>
is defined, this is used to load an initialisation file, which can be used to define methods etc for use in the BeanShell script.
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<a href="#">
^
</a>
</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="preprocessors"><strong>18.7 Pre Processors</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<description >
<br >
</br>
Preprocessors are used to modify the Samplers in their scope.
<br >
</br>
</description>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTML_Link_Parser"><h3>18.7.1 HTML Link Parser</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This modifier parses HTML response from the server and extracts
links and forms. A URL test sample that passes through this modifier will be examined to
see if it "matches" any of the links or forms extracted
from the immediately previous response. It would then replace the values in the URL
test sample with appropriate values from the matching link or form. Perl-type regular
expressions are used to find matches.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
Matches are performed using protocol, host, path and parameter names.
The target sampler cannot contain parameters that are not in the response links.
</td></tr>
</table></p>
<a name="spider_example"/>
<p><b>Spidering Example</b></p>
<p >
Consider a simple example: let's say you wanted JMeter to "spider" through your site,
hitting link after link parsed from the HTML returned from your server (this is not
actually the most useful thing to do, but it serves as a good example). You would create
a
<a href="../usermanual/component_reference.html#Simple_Controller">Simple Controller</a>
, and add the "HTML Link Parser" to it. Then, create an
HTTP Request, and set the domain to ".*", and the path likewise. This will
cause your test sample to match with any link found on the returned pages. If you wanted to
restrict the spidering to a particular domain, then change the domain value
to the one you want. Then, only links to that domain will be followed.
</p>
<a name="poll_example"/>
<p><b>Poll Example</b></p>
<p >
A more useful example: given a web polling application, you might have a page with
several poll options as radio buttons for the user to select. Let's say the values
of the poll options are very dynamic - maybe user generated. If you wanted JMeter to
test the poll, you could either create test samples with hardcoded values chosen, or you
could let the HTML Link Parser parse the form, and insert a random poll option into
your URL test sample. To do this, follow the above example, except, when configuring
your Web Test controller's URL options, be sure to choose "POST" as the
method. Put in hard-coded values for the domain, path, and any additional form parameters.
Then, for the actual radio button parameter, put in the name (let's say it's called "poll_choice"),
and then ".*" for the value of that parameter. When the modifier examines
this URL test sample, it will find that it "matches" the poll form (and
it shouldn't match any other form, given that you've specified all the other aspects of
the URL test sample), and it will replace your form parameters with the matching
parameters from the form. Since the regular expression ".*" will match with
anything, the modifier will probably have a list of radio buttons to choose from. It
will choose at random, and replace the value in your URL test sample. Each time through
the test, a new random value will be chosen.
</p>
<p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img src="../images/screenshots/modification.png"><br>
<font size="-1"> Figure 18 - Online Poll Example
</font></td></tr></table></p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> One important thing to remember is that you must create a test sample immediately
prior that will return an HTML page with the links and forms that are relevant to
your dynamic test sample.
</td></tr>
</table></p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTTP_URL_Re-writing_Modifier"><h3>18.7.2 HTTP URL Re-writing Modifier</h3></a>
</font>
</td></tr>
<tr><td>
<p >
This modifier works similarly to the HTML Link Parser, except it has a specific purpose for which
it is easier to use than the HTML Link Parser, and more efficient. For web applications that
use URL Re-writing to store session ids instead of cookies, this element can be attached at the
ThreadGroup level, much like the
<a href="../usermanual/component_reference.html#HTTP_Cookie_Manager">HTTP Cookie Manager</a>
. Simply give it the name
of the session id parameter, and it will find it on the page and add the argument to every
request of that ThreadGroup.
</p>
<p >
Alternatively, this modifier can be attached to select requests and it will modify only them.
Clever users will even determine that this modifier can be used to grab values that elude the
<a href="../usermanual/component_reference.html#HTML_Link_Parser">HTML Link Parser</a>
.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='485' height='247' src="../images/screenshots/url_rewriter.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name given to this element in the test tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Session Argument Name</td>
<td> The name of the parameter to grab from
previous response. This modifier will find the parameter anywhere it exists on the page, and
grab the value assigned to it, whether it's in an HREF or a form.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Path Extension</td>
<td> Some web apps rewrite URLs by appending
a semi-colon plus the session id parameter. Check this box if that is so.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Do not use equals in path extension</td>
<td> Some web apps rewrite URLs without using an "=" sign between the parameter name and value (such as Intershop Enfinity).
</td>
<td>
No
</td>
</tr>
<tr>
<td>Do not use questionmark in path extension</td>
<td> Prevents the query string to end up in the path extension (such as Intershop Enfinity).
</td>
<td>
No
</td>
</tr>
<tr>
<td>Cache Session Id?</td>
<td>
Should the value of the session Id be saved for later use when the session Id is not present?
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTML_Parameter_Mask"><h3>18.7.3 HTML Parameter Mask</h3></a>
</font>
</td></tr>
<tr><td bgcolor="#bbbb00"><div align="center"><b>*** This element is deprecated. Use <a href="../usermanual/component_reference.html#Counter">Counter</a> instead ***</b></div></td></tr>
<tr><td>
<p >
The HTML Parameter Mask is used to generate unique values for HTML arguments. By
specifying the name of the parameter, a value prefix and suffix, and counter parameters, this
modifier will generate values of the form "
<code >
name=prefixcountersuffix
</code>
". Any HTTP
Request that it modifies, it will replace any parameter with the same name or add the appropriate
parameter to the requests list of arguments.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> The value of the argument in your HTTP Request must be a '*' in order for the HTML Parameter Mask
Modifier to replace it.
</td></tr>
</table></p>
<p >
As an example, the username for a login script could be modified to send a series of values
such as:
<br >
</br>
user_1
<br >
</br>
user_2
<br >
</br>
user_3
<br >
</br>
user_4, etc.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='624' height='209' src="../images/screenshots/parameter_mask.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name given to this element in the test tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Name (second appearing)</td>
<td> The name of the parameter to
modify or add to the HTTP Request.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>ID Prefix</td>
<td> A string value to prefix to every generated value.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Lower Bound</td>
<td> A number value to start the counter at.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Upper Bound</td>
<td> A number value to end the counter, at which point it restarts
with the Lower Bound value.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Increment</td>
<td> Value to increment the counter by each time through.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>ID Suffix</td>
<td> A string value to add as suffix to every generated vaue.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTTP_User_Parameter_Modifier"><h3>18.7.4 HTTP User Parameter Modifier</h3></a>
</font>
</td></tr>
<tr><td bgcolor="#bbbb00"><div align="center"><b>*** This element is deprecated. Use <a href="../usermanual/component_reference.html#User_Parameters">User Parameters</a> instead ***</b></div></td></tr>
<tr><td>
<p >
See also the
<a href="../usermanual/component_reference.html#CSV_Data_Set_Config">CSV Data Set Config</a>
element, which is more suitable for large numbers of parameters
</p>
<p >
The User Parameter Modifier uses an XML file get values for HTTP arguments. Any
HTTP Request that this modifier modifies will be checked for the existence of the specified
arguments. If found, the values for those arguments will be replaced by the values found in the
xml file. The XML file can have multiple sets of the same values. This modifier will iterate
through these values in a round-robin style, thus each request will get a different set of values
until the last set of values is reached, at which point it will begin again at the first set.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='514' height='251' src="../images/screenshots/user_param_modifier.gif"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name given to this element in the test tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>File Name</td>
<td> Name of the XML file in JMeter's /bin directory
that holds the value sets.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="User_Parameters"><h3>18.7.5 User Parameters</h3></a>
</font>
</td></tr>
<tr><td>
<p >
Allows the user to specify values for User Variables specific to individual threads.
</p>
<p >
User Variables can also be specified in the Test Plan but not specific to individual threads. This panel allows
you to specify a series of values for any User Variable. For each thread, the variable will be assigned one of the values from the series
in sequence. If there are more threads than values, the values get re-used. For example, this can be used to assign a distinct
user id to be used by each thread. User variables can be referenced in any field of any jMeter Component.
</p>
<p >
The variable is specified by clicking the Add Variable button in the bottom of the panel and filling in the Variable name in the 'Name:' column.
To add a new value to the series, click the 'Add User' button and fill in the desired value in the newly added column.
</p>
<p >
Values can be accessed in any test component in the same thread group, using the
<a href="functions.html">
function syntax
</a>
: ${variable}.
</p>
<p >
See also the
<a href="../usermanual/component_reference.html#CSV_Data_Set_Config">CSV Data Set Config</a>
element, which is more suitable for large numbers of parameters
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='638' height='274' src="../images/screenshots/user_params.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Update Once Per Iteration</td>
<td> A flag to indicate whether the User Paramters element
should update its variables only once per iteration. if you embed functions into the UP, then you may need greater
control over how often the values of the variables are updated. Keep this box checked to ensure the values are
updated each time through the UP's parent controller. Uncheck the box, and the UP will update the parameters for
every sample request made within its
<a href="build-test-plan.html#scoping_rules">
scope
</a>
.
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Counter"><h3>18.7.6 Counter</h3></a>
</font>
</td></tr>
<tr><td>
<p >
Allows the user to create a counter that can be referenced anywhere
in the Thread Group. The counter config lets the user configure a starting point, a maximum,
and the increment. The counter will loop from the start to the max, and then start over
with the start, continuing on like that until the test is ended.
</p>
<p >
From version 2.1.2, the counter now uses a long to store the value, so the range is from -2^63 to 2^63-1.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='399' height='244' src="../images/screenshots/counter.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Start</td>
<td> The starting number for the counter. The counter will equal this
number during the first iteration.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Increment</td>
<td> How much to increment the counter by after each
iteration.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Maximum</td>
<td> If the counter exceeds the maximum, then it is reset to the Start value.
For versions after 2.2 the default is Long.MAX_VALUE (previously it was 0).
</td>
<td>
No
</td>
</tr>
<tr>
<td>Format</td>
<td> Optional format, e.g. 000 will format as 001, 002 etc.
This is passed to DecimalFormat, so any valid formats can be used.
If there is a problem interpreting the format, then it is ignored.
[The default format is generated using Long.toString()]
</td>
<td>
No
</td>
</tr>
<tr>
<td>Reference Name</td>
<td> This controls how you refer to this value in other elements. Syntax is
as in
<a href="functions.html">
user-defined values
</a>
:
<code >
$(reference_name}
</code>
.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Track Counter Independently for each User</td>
<td> In other words, is this a global counter, or does each user get their
own counter? If unchecked, the counter is global (ie, user #1 will get value "1", and user #2 will get value "2" on
the first iteration). If checked, each user has an independent counter.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="BeanShell_PreProcessor"><h3>18.7.7 BeanShell PreProcessor</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The BeanShell PreProcessor allows arbitrary code to be applied before taking a sample.
</p>
<p >
<b >
Please note that the BeanShell jar file is not included with JMeter; it needs to be separately downloaded.
<br >
</br>
For full details on using BeanShell, please see the BeanShell web-site at http://www.beanshell.org/.
</b>
</p>
<p >
The test element supports the ThreadListener and TestListener methods.
These should be defined in the initialisation file.
See the file BeanShellListeners.bshrc for example definitions.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='597' height='303' src="../images/screenshots/beanshell_preprocessor.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Reset bsh.Interpreter before each call</td>
<td>
If this option is selected, then the interpreter will be recreated for each sample.
This may be necessary for some long running scripts.
For further information, see
<a href="best-practices#bsh_scripting">
Best Practices - BeanShell scripting
</a>
.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Parameters</td>
<td> Parameters to pass to the BeanShell script.
The parameters are stored in the following variables:
<ul >
<li >
Parameters - string containing the parameters as a single variable
</li>
<li >
bsh.args - String array containing parameters, split on white-space
</li>
</ul>
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script file</td>
<td> A file containing the BeanShell script to run.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script</td>
<td> The BeanShell script. The return value is ignored.
</td>
<td>
Yes (unless script file is provided)
</td>
</tr>
</table>
</p>
<p >
The following variables are set up for use by the script:
</p>
<ul >
<li >
log - (Logger) - can be used to write to the log file
</li>
<li >
ctx - (JMeterContext) - gives access to the context
</li>
<li >
vars - (JMeterVariables) - gives read/write access to variables: vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());
</li>
<li >
prev - (SampleResult) - gives access to the previous SampleResult (if any)
</li>
<li >
sampler - (Sampler)- gives access to the current sampler
</li>
</ul>
<p >
For details of all the methods available on each of the above variables, please check the Javadoc
</p>
<p >
If the property
<b >
beanshell.preprocessor.init
</b>
is defined, this is used to load an initialisation file, which can be used to define methods etc for use in the BeanShell script.
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<a href="#">
^
</a>
</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="postprocessors"><strong>18.8 Post-Processors</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<description >
<br >
</br>
As the name suggests, Post-Processors are applied after samplers. Note that they are
applied to
<b >
all
</b>
the samplers in the same scope, so to ensure that a post-processor
is applied only to a particular sampler, add it as a child of the sampler.
<br >
</br>
</description>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Regular_Expression_Extractor"><h3>18.8.1 Regular Expression Extractor</h3></a>
</font>
</td></tr>
<tr><td>
<p >
Allows the user to extract values from a server response using a Perl-type regular expression. As a post-processor,
this element will execute after each Sample request in its scope, applying the regular expression, extracting the requested values,
generate the template string, and store the result into the given variable name.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='494' height='257' src="../images/screenshots/regex_extractor.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Response Field to check</td>
<td> Body, Headers, URL, Response Code, Response Message.
These refer to the Sampler Response. Headers can be useful for HTTP samples; it may not be present for other sample types.
</td>
<td>
yes
</td>
</tr>
<tr>
<td>Reference Name</td>
<td> The name of the JMeter variable in which to store the result. Also note that each group is stored as [refname]_g#, where [refname] is the string you entered as the reference name, and # is the group number, where group 0 is the entire match, group 1 is the match from the first set of parentheses, etc.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Regular Expression</td>
<td> The regular expression used to parse the response data.
This must contain at least one set of parentheses "()" to capture a portion of the string, unless using the group $0$.
Do not enclose the expression in / / - unless of course you want to match these characters as well.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Template</td>
<td> The template used to create a string from the matches found. This is an arbitrary string
with special elements to refer to groups within the regular expression. The syntax to refer to a group is: '$1$' to refer to
group 1, '$2$' to refer to group 2, etc. $0$ refers to whatever the entire expression matches.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Match No.</td>
<td> Indicates which match to use. The regular expression may match multiple times.
<ul >
<li >
Use a value of zero to indicate JMeter should choose a match at random.
</li>
<li >
A positive number N means to select the nth match.
</li>
<li >
Negative numbers are used in conjunction with the ForEach controller - see below.
</li>
</ul>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Default Value</td>
<td>
If no matches are found - and a default is provided - the default value is stored in the variable.
</td>
<td>
No
</td>
</tr>
</table>
</p>
<p >
If the match number is set to a non-negative number, and a match occurs, the variables are set as follows:
<ul >
<li >
refName - the value of the template
</li>
<li >
refName_gn, where n=0,1,2 - the groups for the match
</li>
<li >
refName_g - the number of groups in the Regex (excluding 0)
</li>
</ul>
If no match occurs, then the refName variable is set to the default (unless this is absent).
Also, the following variables are removed:
<ul >
<li >
refName_g0
</li>
<li >
refName_g1
</li>
<li >
refName_g
</li>
</ul>
</p>
<p >
If the match number is set to a negative number, then all the possible matches in the sampler data are processed.
The variables are set as follows:
<ul >
<li >
refName_matchNr - the number of matches found; could be 0
</li>
<li >
refName_n, where n = 1,2,3 etc - the strings as generated by the template
</li>
<li >
refName_n_gm, where m=0,1,2 - the groups for match n
</li>
<li >
refName - always set to the default value
</li>
<li >
refName_gn - not set
</li>
</ul>
Note that the refName variable is always set to the default value in this case,
and the associated group variables are not set.
<p >
See also
<a href="regular_expressions.html">
further information on regular expressions.
</a>
</p>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="XPath_Extractor"><h3>18.8.2 XPath Extractor</h3></a>
</font>
</td></tr>
<tr><td>
This test element allows the user to extract value from
structured response - XML or (X)HTML - using XPath
query language.
<p><b>Control Panel</b></p>
<div align="center"><img width='535' height='176' src="../images/screenshots/xpath_extractor.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Use Tidy</td>
<td> If checked use Tidy to parse HTML response into XHTML.
<ul >
<li >
"Use Tidy" should be checked on for HTML response. Such response is converted to valid XHTML (XML compatible HTML) using Tidy
</li>
<li >
"Use Tidy" should be unchecked for both XHTML or XML response (for example RSS)
</li>
</ul>
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Quiet</td>
<td> Sets the Tidy Quiet flag
</td>
<td>
If Tidy is selected
</td>
</tr>
<tr>
<td>Report Errors</td>
<td> If a Tidy error occurs, then add an Assertion showing the details
</td>
<td>
If Tidy is selected
</td>
</tr>
<tr>
<td>Show warnings</td>
<td> Sets the Tidy showWarnings option
</td>
<td>
If Tidy is selected
</td>
</tr>
<tr>
<td>Use Namespace?</td>
<td>
If checked, then the XML parser will use namespace resolution.
Note that currently only namespaces declared on the root element will be recognised.
A later version of JMeter may support user-definition of additional workspace names.
Meanwhile, a work-round is to replace:
<br >
</br>
//mynamespace:tagname
<br >
</br>
by
<br >
</br>
//*[local-name()='tagname' and namespace-uri()='uri-for-namespace']
<br >
</br>
where "uri-for-namespace" is the uri for the "mynamespace" namespace.
(not applicable if Tidy is selected)
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Reference Name</td>
<td> The name of the JMeter variable in which to store the result.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>XPath Query</td>
<td> Element query in XPath language. Can return more than one match.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Default Value</td>
<td> Default value returned when no match found
</td>
<td>
No
</td>
</tr>
</table>
</p>
<p >
To allow for use in a ForEach Controller, the following variables are set on return:
</p>
<ul >
<li >
refName - set to first (or only) match; if no match, then set to default
</li>
<li >
refName_matchNr - set to number of matches (may be 0)
</li>
<li >
refName_n - n=1,2,3 etc. Set to the 1st, 2nd 3rd match etc.
</li>
</ul>
<p >
Note: The next refName_n variable is set to null - e.g. if there are 2 matches, then refName_3 is set to null,
and if there are no matches, then refName_1 is set to null.
</p>
<p >
XPath is query language targeted primarily for XSLT transformations. However it is usefull as generic query language for structured data too. See
<a href="http://www.topxml.com/xsl/xpathref.asp">
XPath Reference
</a>
or
<a href="http://www.w3.org/TR/xpath">
XPath specification
</a>
for more information. Here are few examples:
</p>
<dl >
<dt >
/html/head/title
</dt>
<dd >
extracts title element from HTML response
</dd>
<dt >
/book/page[2]
</dt>
<dd >
extracts 2nd page from a book
</dd>
<dt >
/book/page
</dt>
<dd >
extracts all pages from a book
</dd>
<dt >
//form[@name='countryForm']//select[@name='country']/option[text()='Czech Republic'])/@value
</dt>
<dd >
extracts value attribute of option element that match text 'Czech Republic'
inside of select element with name attribute 'country' inside of
form with name attribute 'countryForm'
</dd>
</dl>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> When "Use Tidy" is checked on - resulting XML document may slightly differ from original HTML response:
<ul >
<li >
All elements and attribute names are converted to lowercase
</li>
<li >
Tidy attempts to correct improperly nested elements. For example - original (incorrect)
<code >
ul/font/li
</code>
becomes correct
<code >
ul/li/font
</code>
</li>
</ul>
See
<a href="http://jtidy.sf.net">
Tidy homepage
</a>
for more information.
</td></tr>
</table></p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Result_Status_Action_Handler"><h3>18.8.3 Result Status Action Handler</h3></a>
</font>
</td></tr>
<tr><td>
This test element allows the user to stop the thread or the whole test if the relevant sampler failed.
<p><b>Control Panel</b></p>
<div align="center"><img width='697' height='132' src="../images/screenshots/resultstatusactionhandler.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Save_Responses_to_a_file"><h3>18.8.4 Save Responses to a file</h3></a>
</font>
</td></tr>
<tr><td>
This test element can be placed anywhere in the test plan.
For each sample in its scope, it will create a file of the response Data.
The primary use for this is in creating functional tests.
The file name is created from the specified prefix, plus a number.
The file extension is created from the document type, if known.
The generated file name is stored in the sample response, and can be saved
in the test log output file if required.
<p><b>Control Panel</b></p>
<div align="center"><img width='361' height='165' src="../images/screenshots/savetofile.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Filename Prefix</td>
<td> Prefix for the generated file names; this can include a directory name.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Save Failed Responses only</td>
<td> If selected, then only failed responses are saved
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Save Successful Responses only</td>
<td> If selected, then only successful responses are saved
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Generate_Summary_Results"><h3>18.8.5 Generate Summary Results</h3></a>
</font>
</td></tr>
<tr><td>
This test element can be placed anywhere in the test plan.
Generates a summary of the test run so far to the log file and/or
standard output. Both running and differential totals are shown.
Output is generated every n seconds (default 3 minutes) on the appropriate
time boundary, so that multiple test runs on the same time will be
synchronised.The interval is defined by the property "summariser.interval" - see jmeter.properties.
This is mainly intended for batch (non-GUI) runs.
The output looks like the following:
<pre >
label + 171 in 20.3s = 8.4/s Avg: 1129 Min: 1000 Max: 1250 Err: 0 (0.00%)
label + 263 in 31.3s = 8.4/s Avg: 1138 Min: 1000 Max: 1250 Err: 0 (0.00%)
label = 434 in 50.4s = 8.6/s Avg: 1135 Min: 1000 Max: 1250 Err: 0 (0.00%)
label + 263 in 31.0s = 8.5/s Avg: 1138 Min: 1000 Max: 1250 Err: 0 (0.00%)
label = 697 in 80.3s = 8.7/s Avg: 1136 Min: 1000 Max: 1250 Err: 0 (0.00%)
label + 109 in 12.4s = 8.8/s Avg: 1092 Min: 47 Max: 1250 Err: 0 (0.00%)
label = 806 in 91.6s = 8.8/s Avg: 1130 Min: 47 Max: 1250 Err: 0 (0.00%)
</pre>
The "+" means that the line is a delta line, i.e. shows the changes since the last output.
The "=" means that the line is a totals line, i.e. it shows the running total.
Entries in the jmeter log file also include time-stamps.
The Avg, Min and Max times are in milliseonds.
The last two lines will appear at the end of a test.
They will not be synchronised to the appropriate time boundary.
Note that the initial and final deltas may be for less than the interval (in the example above this is 30 seconds).
The first delta will generally be lower, as JMeter synchronises to the interval boundary.
The last delta will be lower, as the test will generally not finish on an exact interval boundary.
<p><b>Control Panel</b></p>
<div align="center"><img width='358' height='131' src="../images/screenshots/summary.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="BeanShell_PostProcessor"><h3>18.8.6 BeanShell PostProcessor</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The BeanShell PreProcessor allows arbitrary code to be applied after taking a sample.
</p>
<p >
For JMeter versions after 2.2 the BeanShell Post-Processor no longer ignores samples with zero-length result data
</p>
<p >
<b >
Please note that the BeanShell jar file is not included with JMeter; it needs to be separately downloaded.
<br >
</br>
For full details on using BeanShell, please see the BeanShell web-site at http://www.beanshell.org/.
</b>
</p>
<p >
The test element supports the ThreadListener and TestListener methods.
These should be defined in the initialisation file.
See the file BeanShellListeners.bshrc for example definitions.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='597' height='303' src="../images/screenshots/beanshell_postprocessor.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Reset bsh.Interpreter before each call</td>
<td>
If this option is selected, then the interpreter will be recreated for each sample.
This may be necessary for some long running scripts.
For further information, see
<a href="best-practices#bsh_scripting">
Best Practices - BeanShell scripting
</a>
.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Parameters</td>
<td> Parameters to pass to the BeanShell script.
The parameters are stored in the following variables:
<ul >
<li >
Parameters - string containing the parameters as a single variable
</li>
<li >
bsh.args - String array containing parameters, split on white-space
</li>
</ul>
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script file</td>
<td> A file containing the BeanShell script to run.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Script</td>
<td> The BeanShell script. The return value is ignored.
</td>
<td>
Yes (unless script file is provided)
</td>
</tr>
</table>
</p>
<p >
The following variables are set up for use by the script:
</p>
<ul >
<li >
log - (Logger) - can be used to write to the log file
</li>
<li >
ctx - (JMeterContext) - gives access to the context
</li>
<li >
vars - (JMeterVariables) - gives read/write access to variables: vars.get(key); vars.put(key,val); vars.putObject("OBJ1",new Object());
</li>
<li >
prev - (SampleResult) - gives access to the previous SampleResult
</li>
<li >
data - (byte [])- gives access to the current sample data
</li>
</ul>
<p >
For details of all the methods available on each of the above variables, please check the Javadoc
</p>
<p >
If the property
<b >
beanshell.postprocessor.init
</b>
is defined, this is used to load an initialisation file, which can be used to define methods etc for use in the BeanShell script.
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<a href="#">
^
</a>
</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="Miscellaneous_Features"><strong>18.9 Miscellaneous Features</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<description >
<br >
</br>
</description>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Test_Plan"><h3>18.9.1 Test Plan</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Test Plan is where the overall settings for a test are specified.
</p>
<p >
Static variables can be defined for values that are repeated throughout a test, such as server names.
For example the variable SERVER could be defined as www.example.com, and the rest of the test plan
could refer to it as ${SERVER}. This simplifies changing the name later.
</p>
<p >
<b >
Note that the Test Plan cannot refer to variables it defines.
</b>
If you need to construct other variables from the Test Plan variables,
use a
<a href="../usermanual/component_reference.html#User_Defined_Variables">User Defined Variables</a>
or a
<a href="../usermanual/component_reference.html#User_Parameters">User Parameters</a>
test element.
</p>
<p >
Selecting Functional Testing instructs JMeter to save the additional sample information
- Response Data and Sampler Data - to all result files.
This increases the resources needed to run a test, and may adversely impact JMeter performance.
If more data is required for a particular sampler only, then add a Listener to it, and configure the fields as required.
[The option does not affect CSV result files, which cannot currently store such information.]
</p>
<p >
Also, an option exists here to instruct JMeter to run the
<a href="../usermanual/component_reference.html#Thread_Group">Thread Group</a>
serially rather than in parallel.
</p>
<p >
Test plan now provides an easy way to add classpath setting to a specific test plan. The feature is additive, meaning that you can add jar files or directories, but removing an entry requires restarting JMeter. In the past, users had to copy all the jar files to jmeter/lib/ directory. Now that is not necessary. JMeter properties also provides an entry for loading additional classpaths.
</p>
<p >
In jmeter.properties, edit "user.classpath" to include additional libraries. Note that paths with spaces may cause problems for Java.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='491' height='439' src="../images/screenshots/testplan.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Thread_Group"><h3>18.9.2 Thread Group</h3></a>
</font>
</td></tr>
<tr><td>
<p >
A Thread Group defines a pool of users that will execute a particular test case against your server. In the Thread Group GUI, you can control the number of users simulated (num of threads), the ramp up time (how long it takes to start all the threads), the number of times to perform the test, and optionally, a start and stop time for the test.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='305' height='390' src="../images/screenshots/threadgroup.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Number of Threads</td>
<td> Number of users to simulate.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Ramp-up Period</td>
<td> How long JMeter should take to get all the threads started. If there are 10 threads and a ramp-up time of 100 seconds, then each thread will begin 10 seconds after the previous thread started, for a total time of 100 seconds to get the test fully up to speed.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Loop Count</td>
<td> Number of times to perform the test case. Alternatively, "forever" can be selected causing the test to run until manually stopped.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Start Time</td>
<td> If the scheduler checkbox is selected, one can choose an absolute start time. When you start your test, JMeter will wait until the specified start time to begin testing.
Note: the Startup Delay field over-rides this - see below.
</td>
<td>
No
</td>
</tr>
<tr>
<td>End Time</td>
<td> If the scheduler checkbox is selected, one can choose an absolute end time. When you start your test, JMeter will wait until the specified start time to begin testing, and it will stop at the specified end time.
Note: the Duration field over-rides this - see below.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Duration (seconds)</td>
<td>
If the scheduler checkbox is selected, one can choose a relative end time.
JMeter will use this to calculate the End Time, and ignore the End Time value.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Startup delay (seconds)</td>
<td>
If the scheduler checkbox is selected, one can choose a relative startup delay.
JMeter will use this to calculate the Start Time, and ignore the Start Time value.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="WorkBench"><h3>18.9.3 WorkBench</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The WorkBench simply provides a place to temporarily store test elements while not in use, for copy/paste purposes, or any other purpose you desire.
When you save your test plan, WorkBench items are not saved with it.
Your WorkBench can be saved independently, if you like (right-click on WorkBench and choose Save).
</p>
<p >
Certain test elements are only available on the WorkBench:
</p>
<ul >
<li >
<a href="../usermanual/component_reference.html#HTTP_Proxy_Server">HTTP Proxy Server</a>
</li>
<li >
<a href="../usermanual/component_reference.html#HTTP_Mirror_Server">HTTP Mirror Server</a>
</li>
<li >
<a href="../usermanual/component_reference.html#Property_Display">Property Display</a>
</li>
</ul>
<p><b>Control Panel</b></p>
<div align="center"><img width='232' height='68' src="../images/screenshots/workbench.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="SSL_Manager"><h3>18.9.4 SSL Manager</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The SSL Manager is a way to select a client certificate so that you can test
applications that use Public Key Infrastructure (PKI).
It is only needed if you have not set up the appropriate System properties.
</p>
<b >
Choosing a Client Certificate
</b>
<p >
You may either use a Java Key Store (JKS) format key store, or a Public Key
Certificate Standard #12 (PKCS12) file for your client certificates. There
is a feature of the JSSE libraries that require you to have at least a six character
password on your key (at least for the keytool utility that comes with your
JDK).
</p>
<p >
To select the client certificate, choose Options->SSL Manager from the menu bar.
You will be presented with a file finder that looks for PKCS12 files by default.
Your PKCS12 file must have the extension '.p12' for SSL Manager to recognize it
as a PKCS12 file. Any other file will be treated like an average JKS key store.
If JSSE is correctly installed, you will be prompted for the password. The text
box does not hide the characters you type at this point--so make sure no one is
looking over your shoulder. The current implementation assumes that the password
for the keystore is also the password for the private key of the client you want
to authenticate as.
</p>
<p >
Or you can set the appropriate System properties - see the system.properties file.
</p>
<p >
The next time you run your test, the SSL Manager will examine your key store to
see if it has at least one key available to it. If there is only one key, SSL
Manager will select it for you. If there is more than one key, it currently selects the first key.
There is currently no way to select other entries in the keystore, so the desired key must be the first.
</p>
<b >
Things to Look Out For
</b>
<p >
You must have your Certificate Authority (CA) certificate installed properly
if it is not signed by one of the five CA certificates that ships with your
JDK. One method to install it is to import your CA certificate into a JKS
file, and name the JKS file "jssecacerts". Place the file in your JRE's
lib/security folder. This file will be read before the "cacerts" file in
the same directory. Keep in mind that as long as the "jssecacerts" file
exists, the certificates installed in "cacerts" will not be used. This may
cause problems for you. If you don't mind importing your CA certificate into
the "cacerts" file, then you can authenticate against all of the CA certificates
installed.
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTTP_Proxy_Server"><h3>18.9.5 HTTP Proxy Server</h3></a>
</font>
</td></tr>
<tr><td>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> The Proxy Server can only record HTTP traffic.
It is not possible to record HTTPS (SSL) sessions; however there is an HTTPS spoofing mode - see below.
</td></tr>
</table></p>
<p >
The Proxy Server allows JMeter to watch and record your actions while you browse your web application
with your normal browser. JMeter will create test sample objects and store them
directly into your test plan as you go (so you can view samples interactively while you make them).
</p>
<p >
To use the proxy server,
<i >
add
</i>
the HTTP Proxy Server element to the workbench.
Select the WorkBench element in the tree, and right-click on this element to get the
Add menu (Add --> Non-Test Elements --> HTTP Proxy Server).
</p>
<p >
You also need to set up your browser to use the JMeter proxy port as the proxy for HTTP requests.
Do not use JMeter as the proxy for any other request types - HTTPS, FTP, etc. - as the JMeter proxy cannot handle them.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='951' height='611' src="../images/screenshots/proxy_control.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this controller that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Port</td>
<td> The port that the Proxy Server listens to. 8080 is the default, but you can change it.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Attempt HTTPS Spoofing</td>
<td>
When you enable HTTPS spoofing, the following happens:
<ul >
<li >
All matching (see below) http requests from the client are turned into https (between the proxy
and the web server).
</li>
<li >
All text response data is scanned and any occurrence of the string "https://"
is replaced with "http://"; the default HTTPS port (443) is also removed if present.
</li>
</ul>
So if you want to use this feature, while you are browsing in your client,
instead of typing "https://..." into the browser, type "http://...".
JMeter will request and record
<i >
everything that matches
</i>
as https, whether it should be or not.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Optional URL match string</td>
<td>
If this is specified, it must be a regular expression (java.util.regex) which matches the
HTTP URL(s) to be spoofed.
For example, if you want to spoof http://a.b.c/service/ but not http://a.b.c/images,
then you could use the expression "http://a.b.c/service/.*".
Note that the expression ends in ".*" because it must match the whole URL.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Target Controller</td>
<td> The controller where the proxy will store the generated samples. By default, it will look for a Recording Controller and store them there wherever it is.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Grouping</td>
<td> Whether to group samplers for requests from a single "click" (requests received without significant time separation), and how to represent that grouping in the recording:
<ul >
<li >
Do not group samplers: store all recorded samplers sequentially, without any grouping.
</li>
<li >
Add separators between groups: add a controller named "--------------" to create a visual separation between the groups. Otherwise the samplers are all stored sequentially.
</li>
<li >
Put each group in a new controller: create a new
<a href="../usermanual/component_reference.html#Simple_Controller">Simple Controller</a>
for each group, and store all samplers for that group in it.
</li>
<li >
Store 1st sampler of each group only: only the first request in each group will be recorded. The "Follow Redirects" and "Retrieve All Embedded Resources..." flags will be turned on in those samplers.
</li>
</ul>
The property
<b >
proxy.pause
</b>
determines the minimum gap that JMeter needs between requests
to treat them as separate "clicks". The default is 1000 (milliseconds) i.e. 1 second.
If you are using grouping, please ensure that you leave the required gap between clicks.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Capture HTTP Headers</td>
<td> Should headers be added to the plan?
If specified, a Header Manager will be added to each HTTP Sampler.
The Proxy server always removes Cookie and Authorization headers from the generated Header Managers.
By default it also removes If-Modified-Since and If-None-Match headers.
These are used to determine if the browser cache items are up to date;
when recording one normally wants to download all the content.
To change which additional headers are removed, define the JMeter property
<b >
proxy.headers.remove
</b>
as a comma-separated list of headers.
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Add Assertions</td>
<td> Add a blank assertion to each sampler?
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Regex Matching</td>
<td> Use Regex Matching when replacing variables?
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Type</td>
<td> Which type of sampler to generate (the Java default or HTTPClient)
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Redirect Automatically</td>
<td> Set Redirect Automatically in the generated samplers?
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Follow Redirects</td>
<td> Set Follow Redirects in the generated samplers?
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Use Keep-Alive</td>
<td> Set Use Keep-Alive in the generated samplers?
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Retrieve all Embedded Resources</td>
<td> Set Retrieve all Embedded Resources in the generated samplers?
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Content Type filter</td>
<td>
Filter the requests based on the content-type - e.g. "text/html [;charset=utf-8 ]".
The fields are regular expressions which are checked to see if they are contained in the content-type.
[Does not have to match the entire field].
The include filter is checked first, then the exclude filter.
Samples which are filtered out will not be stored.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Patterns to Include</td>
<td> Regular expressions that are matched against the full URL that is sampled. Allows filtering of requests that are recorded. All requests pass through, but only
those that meet the requirements of the Include/Exclude fields are
<i >
recorded
</i>
. If both Include and Exclude are
left empty, then everything is recorded (which can result in dozens of samples recorded for each page, as images, stylesheets,
etc are recorded).
<b >
If there is at least one entry in the Include field, then only requests that match one or more Include patterns are
recorded
</b>
.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Patterns to Exclude</td>
<td> Regular expressions that are matched against the URL that is sampled.
<b >
Any requests that match one or more Exclude pattern are
<i >
not
</i>
recorded
</b>
.
</td>
<td>
No
</td>
</tr>
<tr>
<td>Start Button</td>
<td> Start the proxy server. JMeter writes the following message to the console once the proxy server has started up and is ready to take requests: "Proxy up and running!".
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>Stop Button</td>
<td> Stop the proxy server.
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>Restart Button</td>
<td> Stops and restarts the proxy server. This is
useful when you change/add/delete an include/exclude filter expression.
</td>
<td>
N/A
</td>
</tr>
</table>
</p>
<p >
The
<b >
include and exclude patterns
</b>
are treated as regular expressions (using Jakarta ORO).
They will be matched against the host name, port (actual or implied) path and query (if any) of each browser request.
If the URL you are browsing is
<br >
</br>
<b >
"http://jakarta.apache.org/jmeter/index.html?username=xxxx"
</b>
,
<br >
</br>
then the regular expression will be tested against the string:
<br >
</br>
<b >
"jakarta.apache.org:80/jmeter/index.html?username=xxxx"
</b>
.
<br >
</br>
Thus, if you want to include all .html files, your regular expression might look like:
<br >
</br>
<b >
".*\.html(\?.*)?"
</b>
- or
<b >
".*\.html"
</b>
if you know that there is no query string or you only want html pages without query strings.
</p>
<p >
If there are any include patterns, then the URL
<b >
must match at least one
</b>
of the patterns
, otherwise it will not be recorded.
If there are any exclude patterns, then the URL
<b >
must not match any
</b>
of the patterns
, otherwise it will not be recorded.
Using a combination of includes and excludes,
you should be able to record what you are interested in and skip what you are not.
</p>
<p >
N.B. the string that is matched by the regular expression must be the same as the
<b >
whole
</b>
host+path string.
<br >
</br>
Thus
<b >
"\.html"
</b>
will
<b >
not
</b>
match
<b >
j.a.o/index.html
</b>
</p>
<p >
It is also possible to have the proxy add timers to the recorded script. To
do this, create a timer directly within the HTTP Proxy Server component.
The proxy will place a copy of this timer into each sample it records, or into
the first sample of each group if you're using grouping. This copy will then be
scanned for occurences of variable ${T} in its properties, and any such
occurences will be replaced by the time gap from the previous sampler
recorded (in milliseconds).
</p>
<p >
When you are ready to begin, hit "start".
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> You will need to edit the proxy settings of your browser to point at the
appropriate server and port, where the server is the machine JMeter is running on, and
the port # is from the Proxy Control Panel shown above.
</td></tr>
</table></p>
<b >
Where Do Samples Get Recorded?
</b>
<p >
JMeter places the recorded samples in the Target Controller you choose. If you choose the default option
"Use Recording Controller", they will be stored in the first Recording Controller found in the test object tree (so be
sure to add a Recording Controller before you start recording).
</p>
<p >
If the HTTP Proxy Server finds enabled
<a href="../usermanual/component_reference.html#HTTP_Request_Defaults">HTTP Request Defaults</a>
directly within the
controller where samples are being stored, or directly within any of its parent controllers, the recorded samples
will have empty fields for the default values you specified. You may further control this behaviour by placing an
HTTP Request Defaults element directly within the HTTP Proxy Server, whose non-blank values will override
those in the other HTTP Request Defaults. See
<a href="best-practices.html#proxy_server">
Best
Practices with the Proxy Server
</a>
for more info.
</p>
<p >
Similarly, if the HTTP Proxy Server finds
<a href="../usermanual/component_reference.html#User_Defined_Variables">User Defined Variables</a>
(UDV) directly within the
controller where samples are being stored, or directly within any of its parent controllers, the recorded samples
will have any occurences of the values of those variables replaced by the corresponding variable. Again, you can
place User Defined Variables directly within the HTTP Proxy Server to override the values to be replaced. See
<a href="best-practices.html#proxy_server">
Best Practices with the Proxy Server
</a>
for more info.
</p>
<p><table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td> Please note that matching is case-sensitive.
</td></tr>
</table></p>
<p >
Replacement by Variables: by default, the Proxy server looks for all occurences of UDV values.
If you define the variable "WEB" with the value "www", for example,
the string "www" will be replaced by ${WEB} wherever it is found.
To avoid this happening everywhere, set the "Regex Matching" check-box.
This tells the proxy server to treat values as Regexes (using ORO).
<br >
</br>
If you want to match a whole string only, enclose it in ^$, e.g. "^thus$".
<br >
</br>
If you want to match /images at the start of a string only, use the value "^/images".
Jakarta ORO also supports zero-width look-ahead, so one can match /images/...
but retain the trailing / in the output by using "^/images(?=/)".
Note that the current version of Jakara ORO does not support look-behind - i.e. "(?&lt;=...) or (?&lt;!...)".
<br >
</br>
If there are any problems interpreting any variables as patterns, these are reported in jmeter.log,
so be sure to check this if UDVs are not working as expected.
</p>
<p >
When you are done recording your test samples, stop the proxy server (hit the "stop" button). Remember to reset
your browser's proxy settings. Now, you may want to sort and re-order the test script, add timers, listeners, a
cookie manager, etc.
</p>
<b >
How can I record the server's responses too?
</b>
<p >
Just place a
<a href="../usermanual/component_reference.html#View_Results_Tree">View Results Tree</a>
listener as a child of the Proxy Server and the responses will be displayed.
You can also add a
<a href="../usermanual/component_reference.html#Save_Responses_to_a_file">Save Responses to a file</a>
Post-Processor which will save the responses to files.
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTTP_Mirror_Server"><h3>18.9.6 HTTP Mirror Server</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The HTTP Mirrror Server is a very simple HTTP server - it simply mirrors the data sent to it.
This is useful for checking the content of HTTP requests.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='303' height='139' src="../images/screenshots/mirrorserver.png"></div>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Property_Display"><h3>18.9.7 Property Display</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Property Display shows the values of System or JMeter properties.
Values can be changed by entering new text in the Value column.
It is available only on the WorkBench.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='776' height='502' src="../images/screenshots/property_display.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Debug_Sampler"><h3>18.9.8 Debug Sampler</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Debug Sampler generates a sample containing the values of all JMeter variables and/or properties.
</p>
<p >
The values can be seen in the
<a href="../usermanual/component_reference.html#View_Results_Tree">View Results Tree</a>
Listener Response Data pane.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='355' height='172' src="../images/screenshots/debug_sampler.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
<tr>
<td>JMeter Properties</td>
<td> Include JMeter properties ?
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>JMeter Variables</td>
<td> Include JMeter variables ?
</td>
<td>
Yes
</td>
</tr>
<tr>
<td>System Properties</td>
<td> Include System properties ?
</td>
<td>
Yes
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Debug_PostProcessor"><h3>18.9.8 Debug PostProcessor</h3></a>
</font>
</td></tr>
<tr><td>
<p >
The Debug PostProcessor creates a subSample with the details of the previous sampler properties.
This is intended for developer use only.
</p>
<p><b>Control Panel</b></p>
<div align="center"><img width='341' height='134' src="../images/screenshots/debug_postprocessor.png"></div>
<p>
<b>Parameters</b>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Name</td>
<td> Descriptive name for this element that is shown in the tree.
</td>
<td>
No
</td>
</tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<a href="#">
^
</a>
</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="Reports"><strong>18.10 Reports</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<description >
<br >
</br>
</description>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Report_Plan"><h3>18.10.1 Report Plan</h3></a>
</font>
</td></tr>
<tr><td>
<p >
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Report_Table"><h3>18.10.2 Report Table</h3></a>
</font>
</td></tr>
<tr><td>
<p >
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="HTML_Report_Writer"><h3>18.10.3 HTML Report Writer</h3></a>
</font>
</td></tr>
<tr><td>
<p >
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Report_Page"><h3>18.10.4 Report Page</h3></a>
</font>
</td></tr>
<tr><td>
<p >
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Line_Graph"><h3>18.10.5 Line Graph</h3></a>
</font>
</td></tr>
<tr><td>
<p >
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<a name="Bar_Chart"><h3>18.10.6 Bar Chart</h3></a>
</font>
</td></tr>
<tr><td>
<p >
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<a href="#">
^
</a>
</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="functions.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Next</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="boss.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 &copy; 1999-2008, Apache Software Foundation
</em></font></div>
</td></tr>
</table>
</body>
</html>
<!-- end the processing -->