Overview of Jmeter Test Elements

Test Plan

A test plan describes a series of steps Jmeter will execute when run. A complete test plan will consist of one or more Thread Group, logic controllers, sample generating controllers, listeners, timers, assertions and configuration elements.

Thread group

- Thread group elements are the beginning points of any test plan. All controllers and samplers must be under a thread group. Other elements e.g. Listeners, may be placed directly under the test plan, in which case they apply to all the thread groups. As the name implies the thread group element controls the number of threads Jmeter will use to execute your test. The controls for a thread group allow you to :
- Set the number of threads
- Set the ramp-up period
- Set the number of times to execute the test

Controllers

- Jmeter has two types of Controllers Samplers and Logical Controllers
These drive the processing of a test.
- Sampler tells Jmeter to send requests to a server. For example, add an HTTP Request Sampler if you want Jmeter to send an HTTP request. You can also customize a request by adding one or more Configuration Elements to a Sampler.
- Logical Controllers let you customize the logic that Jmeter uses to decide when to send requests. For example you can add an Interleave Logic Controller to alternate between two HTTP Request Samplers.

Samplers

Samplers tell Jmeter to send requests to a server and wait for a response. They are processed in the order they appear in the tree. Controllers can be used to modify the number of repetitions of a sampler, Jmeter samplers include:

1.    FTP Request
2.    HTTP Request
3.    JDBC Request
4.    Java Object Request
5.    LDAP Request
6.    SOAP/XML – RPC Request
7.    Web Service(SOAP) Request

Each sampler has several properties you can set. You can further customize a sampler by adding one or more configuration elements to the test plan.

Logical Controllers

- Logic controllers let you customize the logic that Jmeter uses to decide when to send requests. Logic Controllers can change the order of requests coming from their child elements. They can modify the requests themselves, causes Jmeter to repeat requests, etc.
Listeners
- Listeners provide access to the information Jmeter gathers about the test cases while Jmeter runs. The Graph Results listener plots the response times on a graph. The “View Results Tree” Listener shows details of sampler requests and responses, and can display basic HTML and XML representations of the response. Other listeners provide summary or aggregation information.
- Additionally, listener can direct the data to a file for later use. Every listener in Jmeter provides a provides a filed to indicate the file to store data to. There is also Configuration button which can be used to choose which fields to save, and whether to CSV or XML format. Note that all Listeners save the same data; the only difference is in the way the data is presented on the screen.
- Listeners can be added any where in the test, including directly under the test plan. They will collect data only from elements at or below their level.

Timers

By default, Jmeter thread sends requests without pausing between each request. We recommend that you specify a delay by adding one of the available timers to your Thread Group. If you do not add a delay, Jmeter could overwhelm your server by making too many requests in a very short amount of time, The timer will cause Jmeter to delay a certain amount of time before each request that a thread makes, If you choose to add more than one timer to a Thread Group, Jmeter takes the sum of the timers and pauses for that amount of time before executing the samplers to which the timers apply. Timers can be added as children of samplers or controllers in order to restrict the samplers to which they are applied.

Assertions

Assertions allow you to assert facts about responses received from the server being tested. Using an assertion, you can essentially “test” that your application is returning the results you expect to a query will contain some particular text. The text you specify can be a Perl-style regular expression, and you can indicate that the response is to contain the text, or that it should match the whole response. You can add an assertion to any Sampler. For example you can add an assertion to a HTTP Request that checks for the text is “</HTML>”. Jmeter will then check that the text is present in the HTTP response. If Jmeter cannot find the text, then it will mark this as a failed request. To view the assertion results, add an Assertion Listener to the Thread Group. Failed Assertions will also show up in the Tree View and Table Listeners, and will count towards the error %age for example in the aggregate Summary reports.

Configuration Tool

A configuration element works closely with a Sampler. Although it does not send requests (except for HTTP Proxy Server), it can add to or modify requests.

Pre-Processor Elements

A Pre-Processor executes some action prior to a Sampler Request being made. If a Pre-Processor is attached to a Sampler element, then it will execute just prior to that sampler element running. A pre- processor is most often used to modify the settings of a Sample Request just before it runs, or to update variables that are not extracted from response text.

Post-Processor Elements

A post-processor executes some action after a Sampler Request has been. If a Post-Processor is attached to a Sampler element, then it will execute just after that sampler runs. A Post-Processor is most used to process the response to extract values from it.