JMeter

About

Download

Documentation

JMeter Resources

Community

18.1 Samplers


18.1.1 FTP Request

This controller lets you send an FTP "retrieve file" request to an FTP server. If you are going to send multiple requests to the same FTP server, consider using a FTP Request Defaults Configuration Element so you do not have to enter the same information for each FTP Request Generative Controller.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No
Server Name or IP Domain name or IP address of the FTP server. JMeter assumes the FTP server is listening on the default port. Yes
File to Retrieve From Server Path and name of the file to retrieve. Yes
Username FTP account username. Usually
Password FTP account password. Usually

See Also:



18.1.2 HTTP Request

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 Java applets and sends HTTP requests to retrieve them.

If you are going to send multiple requests to the same web server, consider using an HTTP Request Defaults Configuration Element so you do not have to enter the same information for each HTTP Request.

Or, instead of manually adding HTTP Requests, you may want to use JMeter's HTTP Proxy Server to create them. This can save you time if you have a lot of HTTP requests or requests with many parameters.

There are two versions of the sampler - one uses the default Java HTTP implementation, the other uses Commons HttpClient

If the request requires a login authorization, you will also have to add an HTTP Authorization Manager Configuration Element. And, if the request uses cookies, then you will also need an HTTP Cookie Manager . 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.

If the request uses a technique called "URL Rewriting" to maintain sessions, then see section 6.1 Handling User Sessions With URL Rewriting for additional configuration steps.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No
Server Domain name or IP address of the web server. Yes
Port Port the web server is listening to. No (defaults to 80)
Protocol HTTP or HTTPS. Yes
Method HTTP GET or HTTP POST. Yes
Redirect Automatically Set the http connection to automatically follow redirects. If set, the redirects will not appear as samples, as JMeter never sees them. No
Follow Redirects If set, the JMeter sampler will follow redirects, which will thus appear as samples. No
Use KeepAlive 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. No
Path 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. Yes
Send Parameters With the Request The query string will be generated from the list of parameters you provide. Each parameter has a name and value , 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, 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.

Additionally, you can specify whether each paramter 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 & or spaces, or question marks, then encoding is usually required.

No
Filename 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. No
Parameter Name Name of the web request parameter. No (Yes if Filename filled in)
MIME Type MIME type (for example, text/plain). No (Yes if Filename filled in)
Retrieve All Embedded Resources from HTML Files 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. No
Use as monitor For use with the Monitor Results listener. No

See Also:



18.1.3 JDBC Request

This sampler lets you send an JDBC Request (an SQL query) to a database.

Before using this you need to set up a JDBC Connection Configuration Configuration element

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No
Variable Name Name of the JMeter variable that the connection pool is bound to Yes
Query Only Set this to true for Selects, otherwise False Yes
SQL Query SQL query (for example, "select * from t_customers"). Yes

See Also:



18.1.4 Java Request

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.

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. A simple example (SleepTest) is provided.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this sampler that is shown in the tree. No
Classname The specific implementation of the JavaSamplerClient interface to be sampled. Yes
Send Parameters with Request A list of arguments that will be passed to the sampled class. All arguments are sent as Strings. No



18.1.5 SOAP/XML-RPC Request

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", use the HeaderManager. The sampler will pick up any required headers from 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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this sampler that is shown in the tree. No
URL The URL to direct the SOAP request to. Yes
Soap/XML-RPC Data The Soap XML message, or XML-RPC instructions. No



18.1.6 LDAP Request

This Sampler lets you send a different Ldap request(Add, Modify, Delete and Search) to a LDAP server.

If you are going to send multiple requests to the same LDAP server, consider using an LDAP Request Defaults Configuration Element so you do not have to enter the same information for each LDAP Request.

The same way the Login Config Element also using for Login and password.

Control Panel

There are two ways to create test cases for testing a LDAP Server.

  1. Inbuilt Test cases.
  2. User defined Test cases.

There are four test scenarios of testing LDAP. The tests are given below:

  1. Add Test
    1. Inbuilt test :

      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.

    2. User defined test :

      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.

  2. Modify Test
    1. Inbuilt test :

      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.

    2. User defined test

      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.

  3. Search Test
    1. Inbuilt test :

      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.

    2. User defined test

      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.

  4. Delete Test
    1. Inbuilt test :

      This will create a pre-defined entry first, then it will be deleted from the LDAP Server. The execution time is calculated.

    2. User defined test

      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.

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No
Server Name or IP Domain name or IP address of the LDAP server. JMeter assumes the LDAP server is listening on the default port(389). Yes
Port default port(389). Yes
root DN DN for the server to communicate Yes
Username LDAP server username. Usually
Password LDAP server password. Usually
Entry DN 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 yes
Delete the name of the context to Delete; may not be empty yes
Search base the name of the context or object to search yes
Search filter the filter expression to use for the search; may not be null yes
add test this name, value pair to added in the given context object yes
modify test this name, value pair to add or modify in the given context object yes

See Also:



18.1.6b LDAP Extended Request (ALPHA)

This Sampler can send all 8 different LDAP request to a 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.

If you are going to send multiple requests to the same LDAP server, consider using an LDAP Extended Request Defaults (ALPHA) Configuration Element so you do not have to enter the same information for each LDAP Request.

Control Panel

There are nine test operations defined. These operations are given below:

  1. Thread bind
  2. Any LDAP request is part of a 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 (Distinghuised 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.

    Parameters

    AttributeDescriptionRequired
    Name Descriptive name for this sampler that is shown in the tree. No
    Servername The name (or IP-address) of the LDAP server. Yes
    Port 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). No
    DN The distinghuished 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! No
    Username Full distinghuished name of the user as which you want to bind. No
    Password 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. No

  3. Thread unbind
  4. This is simply the operation to end a session. It is equal to the LDAP "unbind" operation.

    Parameters

    AttributeDescriptionRequired
    Name Descriptive name for this sampler that is shown in the tree. No

  5. Single bind/unbind
  6. 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.

    Parameters

    AttributeDescriptionRequired
    Name Descriptive name for this sampler that is shown in the tree. No
    Username Full distinghuished name of the user as which you want to bind. Yes
    Password Password for the above user. If omitted it will result in an anonymous bind. If is is incorrect, the sampler will return an error. No

  7. Rename entry
  8. 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.

    Parameters

    AttributeDescriptionRequired
    Name Descriptive name for this sampler that is shown in the tree. No
    Old entry name The current distinghuished name of the object you want to rename or move, relative to the given DN in the thread bind operation. Yes
    New distinghuished name The new distinghuished name of the object you want to rename or move, relative to the given DN in the thread bind operation. Yes

  9. Add test
  10. This is the ldap "add" operation. It can be used to add any kind of object to the LDAP server.

    Parameters

    AttributeDescriptionRequired
    Name Descriptive name for this sampler that is shown in the tree. No
    Entry DN Distinghuised name of the object you want to add, relative to the given DN in the thread bind operation. Yes
    Add test 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. Yes

  11. Delete test
  12. This is the LDAP "delete" operation, it can be used to delete an object from the LDAP tree

    Parameters

    AttributeDescriptionRequired
    Name Descriptive name for this sampler that is shown in the tree. No
    Delete Distinghuished name of the object you want to delete, relative to the given DN in the thread bind operation. Yes

  13. Search test
  14. This is the LDAP "search" operation, and will be used for defining searches.

    Parameters

    AttributeDescriptionRequired
    Name Descriptive name for this sampler that is shown in the tree. No
    Search base Distinghuished name of the subtree you want your search to look in, relative to the given DN in the thread bind operation. No
    Search Filter searchfilter, must be specified in LDAP syntax. Yes
    Scope Use 0 for baseobject-, 1 for onelevel- and 2 for a subtree search. (Default=0) No
    Size Limit 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 No
    Time Limit 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) No
    Attributes Specify the attributes you want to have returned, seperated by a semicolon. An empty field will return all attributes No
    Return object Whether the object will be returned (true) or not (false). Default=false No
    Dereference aliases If true, it will dereference aliases, if false, it will not follow them (default=false) No

    .
  15. Modification test
  16. 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.

    Parameters

    AttributeDescriptionRequired
    Name Descriptive name for this sampler that is shown in the tree. No
    Entry name Distinghuished name of the object you want to modify, relative to the given DN in the thread bind operation Yes
    Modification test The attribute-value-opCode triples. The opCode can be any valid LDAP operationCode (add, delete 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. Yes

  17. compare
  18. 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.

    Parameters

    AttributeDescriptionRequired
    Name Descriptive name for this sampler that is shown in the tree. No
    Entry DN The current distinghuished name of the object of which you want to compare an attribute, relative to the given DN in the thread bind operation. Yes
    Compare filter In the form "attribute=value" Yes

See Also:



18.1.7 WebService(SOAP) Request

(Beta Code)

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.

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.

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.

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this sampler that is shown in the tree. No
WSDL URL The WSDL URL with the service description. No
Webmethods The WSDL URL with the service description. No
URL The URL to direct the SOAP request to. Yes
SOAPAction The SOAPAction defined in the webservice description or WSDL. Yes
Soap/XML-RPC Data The Soap XML message Yes
Soap file File containing soap message No
Message Folder Folder containing soap files No
Memory cache caches the request data Yes
Use HTTP Proxy Check box if http proxy should be used No
Proxy Host Proxy hostname No
Proxy Port Proxy host port No



18.1.8 Access Log Sampler

(Alpha Code)

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.

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:

127.0.0.1 - - [21/Oct/2003:05:37:21 -0500] "GET /index.jsp?%2Findex.jsp= HTTP/1.1" 200 8343

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.

org.apache.jmeter.protocol.http.util.accesslog.LogParser

org.apache.jmeter.protocol.http.util.accesslog.Generator

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.

								
            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());

						
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.

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No
Server Domain name or IP address of the web server. Yes
Port Port the web server is listening to. No (defaults to 80)
Log parser class The log parser class is responsible for parsing the logs. No (default provided)
Generator class The generator class is responsible for creating HTTPSampler objects. No (default provided)
Location of log file The location of the access log file. Yes



18.1.9 BeanShell Sampler

This sampler allows you to write a sampler using the BeanShell scripting language.

Please note that the BeanShell jar file is not included with JMeter; it needs to be separately downloaded.

For full details on using BeanShell, please see the BeanShell web-site at http://www.beanshell.org/.

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. no
Parameters List of parameters to be passed to the script file or the script. no
Script File Name of a file to be used as a BeanShell script (yes)
Script Script to be passed to BeanShell (yes)

N.B. Each Sampler instance has its own BeanShell interpeter, and Samplers are only called from a single thread

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: BeanShellFunction.bshrc.

If a script file is supplied, that will be used, otherwise the script will be used.

Before invoking the script, some variables are set up in the BeanShell interpreter:

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.

The full list of variables that is set up is as follows:

  • log - the Logger
  • Label - the Sampler label
  • FileName - the file name, if any
  • Parameters - text from the Parameters field
  • bsh.args - the parameters, split as described above
  • SampleResult - pointer to the current SampleResult
  • ResponseCode = 200
  • ResponseMessage = "OK"
  • IsSuccess = true
  • ctx - JMeterContext
  • vars - JMeterVariables - e.g. vars.get("VAR1"); vars.put("VAR2","value");

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:

  • ResponseCode - for example 200
  • ResponseMessage - for example "OK"
  • IsSuccess - true/false

The Sampler ResponseData is set from the return value of the script.

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:

								
if (bsh.args[0].equalsIgnoreCase("StopThread")) {
    log.info("Stop Thread detected!");
    SampleResult.setStopThread(true);
}
return "Data from sample with Label "+Label;

						


18.1.10 BSF Sampler

This is Alpha code

This sampler allows you to write a sampler using a BSF scripting language.



Please note that the BSF jar file is not included with JMeter; it needs to be separately downloaded. For full details, please see the BSF web-site at http://bsf.jakarta.apache.org/.

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. no
Parameters List of parameters to be passed to the script file or the script. no
Script File Name of a file to be used as a BeanShell script no
Script Script to be passed to BeanShell no



18.1.11 TCP Sampler

ALPHA CODE

The TCP Sampler opens a TCP/IP connection to the specified server. It then sends the text, and waits for a response.

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.

If an error is detected, the socket is closed. Another socket will be reopened on the next sample.

The following properties can be used to control its operation:

  • tcp.status.prefix - text that precedes a status number
  • tcp.status.suffix - text that follows a status number
  • tcp.status.properties - name of property file
  • tcp.handler - Name of TCP Handler class (default TCPClientImpl)
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.

Users can provide their own implementation to replace the supplied class TCPClientImpl. The class must extend org.apache.jmeter.protocol.tcp.sampler.TCPClient.

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).

For example, if the prefix = "[" and the suffix = "]", then the following repsonse:

[J28] XI123,23,GBP,CR

would have the response code J28.

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!]

The login name/password are not used by the supplied TCP implementation.



Sockets are disconnected at the end of a test run.

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Name Descriptive name for this element that is shown in the tree. No
ServerName or IP Name or IP of TCP server Yes
Port Number Port to be used Yes
Timeout (milliseconds) Timeout for replies No
Set Nodelay Should the nodelay property be set? No
Text to Send Text to be sent Yes
Login User User Name No
Password Password No



18.1.12 JMS Publisher

ALPHA CODE

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.



Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
use JNDI properties file use jndi.properties to create topic Yes
JNDI Initial Context Factory Name of the context factory No
Provider URL The URL for the jms provider No
Topic the message topic Yes
Authentication Authentication requirement for the JMS provider Yes
User User Name No
Password Password No
Number of samples to aggregate number of samples to aggregate Yes
configuration setting for the message Yes
Message type text or object message Yes



18.1.13 JMS Subscriber

ALPHA CODE

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.



Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
use JNDI properties file use jndi.properties to create topic Yes
JNDI Initial Context Factory Name of the context factory No
Provider URL The URL for the jms provider No
Topic the message topic Yes
Authentication Authentication requirement for the JMS provider Yes
User User Name No
Password Password No
Number of samples to aggregate number of samples to aggregate Yes
Read response should the sampler read the response Yes
Client Which client to use Yes



18.1.14 JMS Point-to-Point

ALPHA CODE

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.



Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
QueueConnection Factory The JNDI name of the queue connection factory to use for connecting to the messaging system. Yes
JNDI Name Request queue This is the JNDI name of the queue to which the messages are sent. Yes
JNDI Name Reply queue 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. No
Communication style 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. Yes
Timeout 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. Yes
Content The content of the message. No
JMS Properties 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. No
Initial Context Factory The Initial Context Factory is the factory to be used to look up the JMS Resources. No
JNDI properties The JNDI Properties are the specific properties for the underlying JNDI implementation. No
Provider URL The URL for the jms provider. No



18.1.15 Test Action

TBA

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No




18.2 Logic Controllers


18.2.1 Interleave Controller

If you add Generative or Logic Controllers to an Interleave Controller, JMeter will alternate among each of the other controllers for each loop iteration.

Control Panel

Parameters

AttributeDescriptionRequired
name Descriptive name for this controller that is shown in the tree. No
ignore sub-controller blocks If checked, the interleave controller will treat sub-controllers like single request elements and only allow one request per controller at a time. No

Simple Interleave Example

Download 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.


Figure 1 - Interleave Controller Example 1

Loop Iteration Each JMeter Thread Sends These HTTP Requests
1 News Page
2 Log Page
2 FAQ Page
2 Log Page
3 Gump Page
2 Log Page
4 Because there are no more requests in the controller,

JMeter starts over and sends the first HTTP Request, which is the News Page.
2 Log Page
5 FAQ Page
2 Log Page

Useful Interleave Example

Download 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.


Figure 2 - Interleave Controller Example 2

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.


Figure 3 - Interleave Controller Example 3

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.



18.2.2 Loop Controller

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No
Loop Count The number of times the subelements of this controller will be iterated each time through a test run.

Special Case: The Loop Controller embedded in the Thread Group element behaves slightly differently. Unless set to forever, it stops the test after the given number of iterations have been done.

Yes, unless "Forever" is checked

Looping Example

Download 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.


Figure 4 - Loop Controller Example

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.

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.



18.2.3 Once Only Controller

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.

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.

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No

Once Only Example

Download 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.


Figure 5. Once Only Controller Example

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.



18.2.4 Simple Controller

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No

Using the Simple Controller

Download 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.


Figure 6 Simple Controller Example



18.2.5 Random Controller

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.

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

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No



18.2.6 Recording Controller

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 HTTP Proxy Server , all recorded samples will by default be saved under the Recording Controller.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No



18.2.7 Module Controller

The Module Controller provides a mechanism for substituting test plan fragments into the current test plan at run-time. To use this module effectively, one might have a number of Controllers under the WorkBench , 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 it's drop down box. This provides convenience for running many alternate test plans quickly and easily.

Control Panel

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.

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No
Module to Run The module controller provides a list of all controllers loaded into the gui. Select the one you want to substitute in at runtime. Yes



18.2.8 Throughput Controller

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.

Control Panel

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).

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No
Execution Style Whether the controller will run in percent executions or total executions mode. Yes
Throughput 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. Yes
Per User 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. No



18.2.9 If Controller

The If Controller allows the user to control whether the test elements below it (its children) are run or not.

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No
Condition Javascript code that returns "true" or "false" yes

Examples:

  • ${COUNT} < 10
  • "${VAR}" == "abcd"
If there is an error interpreting the code, the condition is assumed to be false, and a message is logged in jmeter.log.



18.2.10 Random Order Controller

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.

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No



18.2.11 ForEach Controller

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:

  • inputVar_1 = wendy
  • inputVar_2 = charles
  • inputVar_3 = peter
  • inputVar_4 = john

Note: the "_" separator is now optional.

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.

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.

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No
Input variable prefix Prefix for the variable names to be used as input. Yes
Output variable The name of the variable which can be used in the loop for replacement in the samplers Yes
Use Separator If not checked, the "_" separator is omitted. Yes

ForEach Example

Download 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.


Figure 7 - ForEach Controller Example

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.

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

In the ForEach loop, a HTTP sampler is added which requests all the links that were extracted from the first returned HTML page.

ForEach Example

Here is another example 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


Figure 8 - ForEach Controller Example 2

The Thread Group has a single thread and a loop count of two.

Sample 1 uses the JavaTest Sampler to return the string "a b c d".

The Regex Extractor uses the expression (\w)\s which matches a letter followed by a space, and returns the letter (not the space). Any matches are prefixed with the string "inputVar".

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.

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.

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.



18.2.12 Transaction Controller

The Transaction Controller times how long it takes for all its children to run. It then adds a "sample" entry to the test output with the total elapsed time. The name of the element is used to name the "sample".

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree, and used to name the transaction. Yes



18.2.12 Runtime Controller

The Runtime Controller controls how long its children are allowed to run.

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree, and used to name the transaction. Yes
Runtime (seconds) Desired runtime in seconds Yes



15.2.13 While Controller

The While Controller runs its children until the condition is "false".

Possible condition values:

  • blank - exit loop when last sample in loop fails
  • LAST - exit loop when last sample in loop fails. If the last sample just before the loop failed, don't enter loop.
  • Otherwise - exit (or don't enter) the loop when the condition is equal to the string "false"

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.



For example:
  • ${VAR} - where VAR is set to false by some other test element
  • ${__javaScript(${C}==10,dummy)}
  • ${__javaScript("${VAR2}"=="abcd",dummy)}
  • ${_P(property)} - where property is set to "false" somewhere else

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree, and used to name the transaction. Yes
Condition blank, LAST, or variable/function Yes



18.2.14 Switch Controller

The Switch Controller acts like the Interleave Controller in that it runs one of the subordinate elements on each iteration, but rather than run them in sequence, the controller runs the element number defined by the switch value.

If the switch value is out of range, it will run the zeroth element, which therefore acts as the default.

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree, and used to name the transaction. Yes
Switch Value The number of the subordinate element to be invoked. Elements are numbered from 0. Yes




18.3 Listeners


Most of the listeners perform several roles in addition to "listening" to the test results. They frequently also provide means to view, save, and read saved test results.

Note that Listeners are processed at the end of the scope in which they are found.

The saving and reading of test results is generic. The various listeners generally have a panel whereby one can specify the file to which the results will be written (or read). By default, the results are stored as CSV files, typically with a ".jtl" extension. Storing as CSV is the most efficient option, but is less detailed than XML (the other available option).

To read existing results and display them, use the file panel Browse button to open the file.

To change the format, in jmeter.properties, find the following line:

jmeter.save.saveservice.output_format=csv

Change "csv" to "xml" for greater detail.

The information to be saved is configurable. For maximum information, choose "xml" as the format and specify "Functional Test Mode" on the Test Plan element. If this box is not checked, the default saved data includes a time stamp (the number of milliseconds since midnight, January 1, 1970 UTC), the data type, the thread name, the label, the response time, message, and code, and a success indicator. If checked, all information, including the full response data will be logged.

One can get a more selective set of information my modifying the jmeter.properties file. The following example indicates how to set properties to get a vertical bar ("|") delimited format that will output results like:.

								
timeStamp|time|label|responseCode|threadName|dataType|success|failureMessage
02/06/03 08:21:42|1187|Backoffice Home|200|Thread Group-1|text|true|
02/06/03 08:21:42|47|Login BO|200|Thread Group-1|text|false|Test Failed, 
	expected to contain: password etc.

						

The corresponding jmeter.properties file excerpt is below. One oddity in this example is that the output_format is set to csv, which typically indicates comma-separated values. However, the default_delimiter was set to be a vertical bar instead of a comma, so the csv tag is a misnomer in this case.

								
    #---------------------------------------------------------------------------
    # Results file configuration
    #---------------------------------------------------------------------------
    
    # This section helps determine how result data will be saved.
    # The commented out values are the defaults.
    
    # legitimate values: xml, csv, db.  Only xml and csv are currently supported.
    jmeter.save.saveservice.output_format=csv
    
    # true when field should be saved; false otherwise
    
    # assertion_results_failure_message only affects CSV output
    jmeter.save.saveservice.assertion_results_failure_message=true
    jmeter.save.saveservice.data_type=true
    jmeter.save.saveservice.label=true
    jmeter.save.saveservice.response_code=true
    jmeter.save.saveservice.response_data=false
    jmeter.save.saveservice.response_message=false
    jmeter.save.saveservice.successful=true
    jmeter.save.saveservice.thread_name=true
    jmeter.save.saveservice.time=true
    
    # legitimate values: none, ms, or a format suitable for SimpleDateFormat
    #jmeter.save.saveservice.timestamp_format=ms
    jmeter.save.saveservice.timestamp_format=MM/dd/yy HH:mm:ss
    
    # legitimate values: none, first, all
    jmeter.save.saveservice.assertion_results=first
    
    # For use with Comma-separated value (CSV) files or other formats
    # where the fields' values are separated by specified delimiters.
    jmeter.save.saveservice.default_delimiter=|
    jmeter.save.saveservice.print_field_names=true

						

The date format to be used for the timestamp_format is described in SimpleDateFormat . Bear in mind that choosing a date format other than "ms" is likely to make it impossible for JMeter to interpret the value when it is read in later for viewing purposes.

The internal viewing capabilities are described in the following subsections.



18.3.1 Mailer Visualizer

The mailer visualizer can be set up to send email if a test run receives too many failed responses from the server.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
From Email address to send messages from. Yes
Addressie(s) Email address to send messages to. Yes
SMTP Host IP address or host name of SMTP (email redirector) server. No
Failure Subject Email subject line for fail messages. No
Success Subject Email subject line for success messages. No
Failure Limit Once this number of failed responses are received, a failure email is sent. Yes
Success Limit Once this number of successful responses are received after previously reaching the failure limit , a success email is sent. The mailer will thus only send out messages in a sequence of failed-succeeded-failed-succeeded, etc. Yes
Test Mail No
Failures A field that keeps a running total of number of failures so far received. No



18.3.2 Graph Full Results

No Description


18.3.3 Graph Results

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.

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.

Control Panel



18.3.4 Spline Visualizer

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.

Control Panel



18.3.5 Assertion Results

The Assertion Results visualizer shows the URL of each sample taken (no time information is shown). It also reports failures of any Assertions that are part of the test plan.

Control Panel

See Also:



18.3.6 View Results Tree

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.

There are three ways to view the response, selectable by a radio button.

The default view shows all of the text contained in the response.

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.

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.

Control Panel

The Control Panel (above) shows an example of an HTML display. Figure 9 (below) shows an example of an XML display.


Figure 9 Sample XML display



18.3.7 Aggregate Report

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.

Control Panel



18.3.8 View Results in Table

This visualizer creates a row for every sample result. Each sample result's URL, time in milliseconds, success/failure is displayed. Like the View Results Tree , this visualizer uses a lot of memory. The last column shows the number of bytes for the response from the server.

Control Panel



18.3.9 Simple Data Writer

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.


18.3.10 Monitor Results

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.

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.

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.

Control Panel



18.3.11 Distribution Graph (alpha)

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.

Control Panel




18.4 Configuration Elements


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.

18.4.1 HTTP Authorization Manager

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.

The Authorization Manager lets you specify one or more user logins for web pages that are restricted using Basic HTTP 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.

In the current release, all JMeter threads in a Thread Group use the same username/password for a given Base URL even if you create multiple users with the same Base URL in the authorization table. We plan to correct this in a future release. As a workwaround, you can create multiple Thread Groups for your Test Plan, with each Thread Group having its own Authorization Manager.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Base URL 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". Yes
Username The username to authorize. Yes
Password The password to authorize. Yes

Controls:
  • Add Button - Add an entry to the authorization table.
  • Delete Button - Delete the currently selected table entry.
  • Load Button - Load a previously saved authorization table and add the entries to the existing authorization table entries.
  • Save As Button - Save the current authorization table to a file.

When you save the Test Plan, JMeter automatically saves all of the authorization table entries.

Authorization Example

Download 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/index1.html" and "/secret/index2.html". The other HTTP request, named "NoSecretPage" makes a request to "/index.html".


Figure 10 - Test Plan


Figure 11 - Authorization Manager Control Panel

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.

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.



18.4.2 HTTP Cookie Manager

If there is more than one Cookie Manager in the scope of a Sampler, there is currently no way to sepcify which one is to be used.

The Cookie Manager element has two functions:

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.

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.

Note that an Expiration time of 0 is treated as never expiring.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Cookies Stored in the Cookie Manager This gives you the opportunity to use hardcoded cookies that will be used by all threads during the test execution. No (discouraged, unless you know what you're doing)
Add Button Add an entry to the cookie table. N/A
Delete Button Delete the currently selected table entry. N/A
Load Button Load a previously saved cookie table and add the entries to the existing cookie table entries. N/A
Save As Button Save the current cookie table to a file. N/A



18.4.3 HTTP Proxy Server

The Proxy Server can only record HTTP traffic. There is currently no support for recording HTTPS (SSL) sessions.

The Proxy Server allows JMeter to watch and record your actions while you browse your web application with your normal browser (such as Internet Explorer). 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).

To use the proxy server, add 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).

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No
Port The port that the Proxy Server listens to. 8080 is the default, but you can change it. Yes
Capture HTTP Headers Should headers be added to the plan? Yes
Set Keep-Alive Automatically set Keep-Alive in the generated samplers? Yes
Add Assertions Add a blank assertion to each sampler? Yes
Regex Matching Use Regex Matching when replacing variables? Yes
Target Controller 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. Yes
Grouping 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:
  • Do not group samplers: store all recorded samplers sequentially, without any grouping.
  • Add separators between groups: add a controller named "--------------" to create a visual separation between the groups. Otherwise the samplers are all stored sequentially.
  • Put each group in a new controller: create a new Simple Controller for each group, and store all samplers for that group in it.
  • 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.
Yes
Patterns to Include 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 recorded . 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). If there is at least one entry in the Include field, then only requests that match one or more Include patterns are recorded . No
Patterns to Exclude Regular expressions that are matched against the URL that is sampled. Any requests that match one or more Exclude pattern are not recorded . No
Start Button 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!". N/A
Stop Button Stop the proxy server. N/A
Restart Button Stops and restarts the proxy server. This is useful when you change/add/delete an include/exclude filter expression. N/A

To add an entry to the Include or Exclude field, type the entry into the text field, and hit "Enter" when done. The text will be added to the List box to the right of the text field. To clear the text field, hit the "clear" button. Currently, there is no way to individually select items and delete them.

These entries will be treated as Perl-type regular expressions. They will be matched against the host name + the path of each browser request. Thus, if the URL you are browsing is http://jakarta.apache.org/jmeter/index.html?username=xxxx , then the regular expression will be tested against the string: "jakarta.apache.org/jmeter/index.html" . Thus, if you wanted to include all .html files, you're regular expression might look like: ".*\.html" . Using a combination of includes and excludes, you should be able to record what you are interested in and skip what you are not.

N.B. the string that is matched by the regular expression must be the same as the whole host+path string.

Thus "\.html" will not match j.a.o/index.html

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).

When you are ready to begin, hit "start".

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.

Where Do Samples Get Recorded?

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).

If the HTTP Proxy Server finds enabled HTTP Request Defaults 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 Best Practices with the Proxy Server for more info.

Similarly, if the HTTP Proxy Server finds User Defined Variables (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 Best Practices with the Proxy Server for more info.

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).

If you want to match a whole string only, enclose it in ^$, e.g. "^thus$".

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. "(?<=...)".

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.

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.

How can I record the server's responses too?

Just place a View Results Tree listener as a child of the Proxy Server and the responses will be displayed. You can also add a Save Responses to a file Post-Processor which will save the responses to files.



18.4.4 HTTP Request Defaults

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this controller that is shown in the tree. No
Server Domain name or IP address of the web server. Yes
Port Port the web server is listening to. No (defaults to 80)
Protocol HTTP or HTTPS. Yes
Method HTTP GET or HTTP POST. Yes
Path 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. Yes
Send Parameters With the Request The query string will be generated from the list of parameters you provide. Each parameter has a name and value . 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. No



18.4.5 FTP Request Defaults

Control Panel



18.4.6 JDBC Connection Configuration

Creates a database connection pool (used by JDBC Request Sampler) with JDBC Connection settings.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for the connection pool that is shown in the tree. No
Variable Name 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. Yes
Max Number of Connections Maximum number of connections allowed in the pool Yes
Pool timeout Pool throws an error if the timeout period is exceeded in the process of trying to retrieve a connection Yes
Idle Cleanup Interval (ms) Uncertain what exactly this does. Yes
Auto Commit Turn auto commit on or off for the connections. Yes
Keep-alive Uncertain what exactly this does. Yes
Max Connection Age (ms) Uncertain what exactly this does. Yes
Validation Query A simple query used to determine if the database is still responding. Yes
Database URL JDBC Connection string for the database. Yes
JDBC Driver class Fully qualified name of driver class. (Must be in JMeter's classpath - easiest to copy .jar file into JMeter's /lib directory). Yes
Username Name of user to connect as. Yes
Password Password to connect with. Yes



18.4.7 JDBC SQL Query Defaults

Defines a default query for the JDBC Request Sampler.

Connection settings are defined by the JDBC Connection Configuration element.

Control Panel



18.4.8 Mail Reader Sampler

TBA


18.4.9 HTTP Header Manager

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.

The Header Manager lets you add or override HTTP request headers.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Name (Header) Name of the request header. Two common request headers you may want to experiment with are "User-Agent" and "Referer". No (You should have at least one, however)
Value Request header value. No (You should have at least one, however)
Add Button Add an entry to the header table. N/A
Delete Button Delete the currently selected table entry. N/A
Load Button Load a previously saved header table and add the entries to the existing header table entries. N/A
Save As Button Save the current header table to a file. N/A

Header Manager example

Download 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).


Figure 12 - Test Plan


Figure 13 - Header Manager Control Panel



18.4.10 Login Config Element

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Username The default username to use. No
Password The default password to use. No



18.4.11 Simple Config Element

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Parameter Name 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. Yes
Parameter Value The value to apply to that parameter. Yes



18.4.12 LDAP Request Defaults

The LDAP Request Defaults component lets you set default values for LDAP testing. See the LDAP Request .

Control Panel



18.4.12b LDAP Extended Request Defaults (ALPHA)

The LDAP Extended Request Defaults component lets you set default values for extended LDAP testing. See the LDAP Extended Request (ALPHA) .

Control Panel



18.4.13 Java Request Defaults

The Java Request Defaults component lets you set default values for Java testing. See the Java Request .

Control Panel



18.4.14 User Defined Variables

The User Defined Variables lets you define variables for use in other test elements, just as in the Test Plan . 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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
User Defined Variables 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. No



18.4.15 TCP Sampler Config

ALPHA CODE

The TCP Sampler Config provides default data for the TCP Sampler

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
ServerName or IP Name or IP of TCP server No
Port Number Port to be used No
Timeout (milliseconds) Timeout for replies No
Set Nodelay Should the nodelay property be set? No
Text to Send Text to be sent No



18.4.16 CSV Data Set Config

CSV DataSet Config is used to read lines from a file, and split them into variables.

As a special case, the string "\\t" (without quotes) is treated as a Tab.

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Filename Name of the file to be read. Yes
Variable Names List of variable names (comma-delimited) Yes
Delimiter Delimiter to be used to split the records in the file. Yes



18.4.17 JNDI Default Configuration

TBA.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Initial Context Factory TBA No
Provider URL TBA No




18.5 Assertions


Assertions are used to perform additional checks on samplers, and are processed after each sampler in the same scope.

18.5.1 Response Assertion

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. You can also choose whether the strings will be expected to match the entire response, or if the response is only expected to contain the pattern. You can attach multiple assertions to any controller for additional flexibility.

Note that the pattern string should not include the enclosing delimiters, i.e. use Price: \d+ not /Price: \d+/ . 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. Case is also significant. To override these settings, one can use the extended regular expression syntax. For example:

								
	(?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"

						

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Response Field to Test 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 Code (e.g. 404) or the Response Message (e.g. Not Found).

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.

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.
Yes
Pattern Matching Rules Indicates whether the text being tested must CONTAIN or MATCH the test patterns. NOT may also be selected to indicate the text should NOT CONTAIN or NOT MATCH the test patterns. Yes
Patterns to Test A list of regular expressions to be tested. Each pattern is tested separately. 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). Yes

The pattern is a Perl5-style regular expression, but without the enclosing brackets.

Assertion Examples


Figure 14 - Test Plan


Figure 15 - Assertion Control Panel with Pattern


Figure 16 - Assertion Listener Results (Pass)


Figure 17 - Assertion Listener Results (Fail)



18.5.2 Duration Assertion

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Duration in Milliseconds The maximum number of milliseconds each response is allowed before being marked as failed. Yes



18.5.3 Size Assertion

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Size in bytes The number of bytes to use in testing the size of the response. Yes
Type of Comparison Whether to test that the response is equal to, greater than, less than, or not equal to, the number of bytes specified. Yes



18.5.4 XML Assertion

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No



18.5.5 BeanShell Assertion

The BeanShell Assertion allows the user to perform assertion checking using a BeanShell script.

Please note that the BeanShell jar file is not included with JMeter; it needs to be downloaded separately and placed in the lib directory.

For full details on using BeanShell, please see the BeanShell web-site at http://www.beanshell.org/.

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.

All Assertions are called from the same thread as the sampler.

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

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Parameters Parameters to pass to the BeanShell script. The parameters are stored in the following variables:
  • Parameters - string containing the parameters as a single variable
  • bsh.args - String array containing parameters, split on white-space
No
Script file A file containing the BeanShell script to run No
Script The BeanShell script to run No

There's a sample script you can try.

The following variables are defined to the script. These are strings unless otherwise noted:

  • log - the Logger Object. (e.g.) log.warn("Message"[,Throwable])
  • SampleResult - the SampleResult Object; read-write
  • Response - the response Object; read-write
  • Failure - boolean; read-write; used to set the Assertion status
  • FailureMessage - String; read-write; used to set the Assertion message
  • ResponseData - the response body (byte [])
  • ResponseCode - e.g. 200
  • ResponseMessage - e.g. OK
  • ResponseHeaders - contains the HTTP headers
  • RequestHeaders - contains the HTTP headers sent to the server
  • SampleLabel
  • SamplerData - data that was sent to the server
  • ctx - JMeterContext
  • vars - JMeterVariables - e.g. vars.get("VAR1"); vars.put("VAR2","value");

The following methods of the Response object may be useful:

  • setStopThread(boolean)
  • setStopTest(boolean)
  • String getSampleLabel()
  • setSampleLabel(String)



18.5.6 MD5Hex Assertion

The MD5Hex Assertion allows the user to check the MD5 hash of the response data.

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
MD5 sum 32 hex digits representing the MD5 hash (case not significant) Yes



18.5.7 HTML Assertion

The HTML Assertion allows the user to check the HTML syntax of the response data using JTidy.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
doctype omit/auto/strict/loose Yes
Format HTML, XHTML or XML Yes
Errors only Only take note of errors? Yes
Error threshold Number of errors allowed before classing the response as failed Yes
Warning threshold Number of warnings allowed before classing the response as failed Yes
Filename Name of file to which report is written No



18.5.8 XPath Assertion

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. See http://www.w3.org/TR/xpath for more information on XPath.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Tolerant Parser Be tolerant of XML/HTML errors No
Use Namespaces Should namespaces be honoured? No
Validate XML Check the document against its schema. No
XPath Assertion XPath to match in the document. Yes
Ignore Whitespace Ignore Element Whitespace. No
True if nothing matches True if a XPath expression is not matched No



18.5.9 XML Schema Assertion

The XML Schema Assertion allows the user to validate a response against an XML Schema.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
File Name Specify XML Schema File Name Yes




18.6 Timers


Note that timers are processed at the start of the scope in which they are found; if there are several timers in the same scope, all the timers will be processed. To apply a timer to a single sampler, add the timer as a child element to 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 simple logic controller immediately after the sampler.

18.6.1 Constant Timer

If you want to have each thread pause for the same amount of time between requests, use this timer.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this timer that is shown in the tree. No
Thread Delay Number of milliseconds to pause. Yes



18.6.2 Gaussian Random Timer

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this timer that is shown in the tree No
Deviation Deviation in milliseconds. Yes
Constant Delay Offset Number of milliseconds to pause in addition to the random delay. Yes



18.6.3 Uniform Random Timer

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this timer that is shown in the tree. No
Random Delay Maximum Maxium random number of milliseconds to pause. Yes
Constant Delay Offset Number of milliseconds to pause in addition to the random delay. Yes



18.6.4 Constant Throughput Timer

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.

Only samples within the container where you put the timer count towards the calculated throughput. Also note that the total time (used in the denominator to calculate the throughput) starts counting with the first such sample -- not with the test start.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this timer that is shown in the tree. No
Target Throughput Throughput we want the timer to try to generate. Yes
Legacy Mode If True, calculate throughput for each thread separately.

If False, calculate throughput based on the total number of threads.
Yes



18.6.5 Synchronizing Timer

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this timer that is shown in the tree. No
Number of Simultaneous Users to Group by Number of threads to release at once. Yes




18.7 Pre Processors


Preprocessors are used to modify the Samplers in their scope.

18.7.1 HTML Link Parser

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.

Spidering Example

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 Simple Controller , 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.

Poll Example

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.


Figure 18 - Online Poll Example

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.



18.7.2 HTTP URL Re-writing Modifier

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 HTTP Cookie Manager . 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.

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 HTML Link Parser .

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name given to this element in the test tree. No
Session Argument Name 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. Yes
Path Extension Some web apps rewrite URLs by appending a semi-colon plus the session id parameter. Check this box if that is so. No
Do not use equals in path extension Some web apps rewrite URLs without using an "=" sign between the parameter name and value (such as Intershop Enfinity). No
Do not use questionmark in path extension Prevents the query string to end up in the path extension (such as Intershop Enfinity). No



18.7.3 HTML Parameter Mask

* - This element is deprecated. Use Counter instead

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 " name=prefixcountersuffix ". 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.

The value of the argument in your HTTP Request must be a '*' in order for the HTML Parameter Mask Modifier to replace it.

As an example, the username for a login script could be modified to send a series of values such as:

user_1

user_2

user_3

user_4, etc.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name given to this element in the test tree. No
Name (second appearing) The name of the parameter to modify or add to the HTTP Request. Yes
ID Prefix A string value to prefix to every generated value. No
Lower Bound A number value to start the counter at. Yes
Upper Bound A number value to end the counter, at which point it restarts with the Lower Bound value. Yes
Increment Value to increment the counter by each time through. Yes
ID Suffix A string value to add as suffix to every generated vaue. No



18.7.4 HTTP User Parameter Modifier

* - This element is deprecated. Use User Parameters instead

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.

If the number of value sets is equal to the number of threads in your test, then it will work out that each thread will get the same set of values each time, which will be a different set from any other thread

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name given to this element in the test tree. No
File Name Name of the XML file in JMeter's /bin directory that holds the value sets. Yes



18.7.5 User Parameters

Allows the user to specify values for User Variables specific to individual threads.

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.

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.

Values can be accessed in any test component in the same thread group, using the function syntax : ${variable}.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Update Once Per Iteration A flag to indicate whether the User Paramters element should update it's 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 it's scope . Yes



18.7.6 Counter

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Start The starting number for the counter. The counter will equal this number during the first iteration. Yes
Increment How much to increment the counter by after each iteration. Yes
Maximum If the counter exceeds the maximum, then it is reset to the Start value. Yes
Reference Name This controls how you refer to this value in other elements. Syntax is as in user-defined values : $(reference_name} . Yes
Track Counter Independently for each User 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. No




18.8 Post-Processors


As the name suggests, Post-Processors are applied after samplers. Note that they are applied to all 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.

18.8.1 Regular Expression Extractor

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Reference Name 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. Yes
Regular Expression 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$. Yes
Template 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. Yes
Match No. Indicates which match to use. The regular expression may match multiple times.
  • Use a value of zero to indicate JMeter should choose a match at random.
  • A positive number N means to select the nth match.
  • Negative numbers are used in conjunction with the ForEach controller - see below.
Yes
Default Value If no matches are found, the default value is stored in the variable. No

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:

  • refName_matchNr - the number of matches found; could be 0
  • refName_n, where n = 1,2,3 etc - the strings as generated by the template
  • refName_n_gm, where m=0,1,2 - the groups for match n
  • refName - always set to the default value
  • refName_gn - not set
Note that the refName variable is always set to the default value in this case, and the associated group variables are not set.



18.8.2 Result Status Action Handler

This test element allows the user to stop the thread or the whole test if the relevant sampler failed.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No



18.8.3 Save Responses to a file

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 know.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Filename Prefix Prefix for the generate file name No



18.8.4 Generate Summary Results

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. This is mainly intended for batch (non-GUI) runs.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No




18.9 Miscellaneous Features


18.9.1 Test Plan

At the Test Plan level, static variables can be defined that allow users to abstract values that are repeated throughout their tests, such as server names. Here, one can instruct JMeter to save the maximum sample information to file by selecting "functional testing". Also, an option exists here to instruct JMeter to run the Thread Group serially rather than in parallel.

Control Panel



18.9.2 Thread Group

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.

Control Panel

Parameters

AttributeDescriptionRequired
Name Descriptive name for this element that is shown in the tree. No
Number of Threads Number of users to simulate. Yes
Ramp-up Period 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. Yes
Loop Count Number of times to perform the test case. Alternatively, "forever" can be selected causing the test to run until manually stopped. No
Start Time 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. No
End Time 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. No
Duration (seconds) 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. No
Startup delay (seconds) 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. No



18.9.3 WorkBench

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).

Control Panel



18.9.4 SSL Manager

The SSL Manager is a way to select a client certificate so that you can test applications that use Public Key Infrastructure (PKI). In order to use it, you must have JSSE 1.0.2 installed. Unfortunately, there is no standard method for controling who a client is--and that won't be introduced until JDK 1.4 is officially available. The SSL Manager should still work with JDK 1.4, so this is the best solution we could come up with.

Choosing a Client Certificate

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 bug in 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).

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.

The next time you run your test, the SSL Manager will examine your key store to see if it has more than 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, you will be prompted to select the alias you wish to authenticate as. If SSL Manager cannot detect any keys in your keystore, it will give you a text box for the off chance you know something it doesn't. Keep in mind that for the first run, you will be prompted once per thread. Try to use only one thread for the first run to ensure everything is working properly.

Things to Look Out For

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.





Copyright © 1999-2005, Apache Software Foundation