Elements of a Test Plan in JMeter

Elements or components of a JMeter Test Plan would comprise at least one Thread Group. Test plan is the container for all test objects. Test plans are sets of requests against local or remote servers (or clients) configured to run by following specific instructions.
JMeter test plans are composed of different elements. Here is a list of the most important ones and we will discuss them one by one in next sections:

  • Thread Group
  • Controllers
  • Assertions
  • Listeners
  • Timers
  • Processor
  • Configuration Elements

Thread Group

Thread group is the first step to start anything with JMeter Test Plan. This is where you specify the number of users that you want JMeter to simulate when executing the test plan (one thread = one simulated user). You can also set the Ramp-up Period to tell JMeter how long it should take to reach the full number of threads chosen and the Loop Count—the number of iterations for each user in the group. 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

We will discuss more on thread group in next tutorial with an example. Thread Group In JMeter With Examples

Controller

JMeter has two types of Controllers: Samplers and Logical Controllers.

Samplers

Samplers tell JMeter to send requests to a server and wait for a response and they are processed in the order they appear in the tree. Each Sampler produces sample results that may have various attributes, such as performance, elapsed time, throughput, etc.

For an example, add an HTTP Request Sampler if we want JMeter to send an HTTP request. We can also customize a request by adding one or more Configuration Elements to a Sampler.

Below are JMeter Samplers which are available :

  • FTP Request
  • HTTP Request (can be used for SOAP or REST Webservice also)
  • JDBC Request
  • Java object request
  • JMS request
  • JUnit Test request
  • LDAP Request
  • Mail request
  • OS Process request
  • TCP request

Each sampler has several properties that we can set. We can further customize a sampler by adding one or more Configuration Elements to the Test Plan. We will see more about samplers and how to use samplers in coming tutorials.

Logic Controller

Logic Controllers let you customize the logic that JMeter uses to decide when to send requests. A Logic Controller can changes the order of requests that come from its child elements. The child elements of a Logic Controller may comprise Samplers, Configuration Elements, and more Logic Controllers. For these requests, JMeter may randomly select (using Random Controller), repeat (using Loop Controller), interchange (using Interleave Controller) etc.

JMeter Logic Controllers gives us an ability to control “when” to send a user request to a web server under test. With logic controllers, we can manage the execution order of different elements in Test Plan.

Logic Controller which are available in JMeter are:

  • Simple Controller
  • Loop Controller
  • Once Only Controller
  • Interleave Controller
  • Random Controller
  • Random Order Controller
  • Throughput Controller
  • Runtime Controller
  • If Controller
  • While Controller
  • Switch Controller
  • ForEach Controller
  • Module Controller
  • Include Controller
  • Transaction Controller
  • Recording Controller

To understand more about Logic controllers, we will take and example and discuss more in details in coming tutorials.

Timer

JMeter thread executes samplers in sequence without pausing by default. If we don't specify a delay by adding any of the available timers to the Thread Group, Target Server will receive too many requests in a very short amount of time which may lead to server overload. Timer is mainly used to define the time period that you want to wait between each requests. The goal of timers is to simulate real user behavior by waiting between the interactions with a web application as the whole idea of the load testing is simulating real user’s behavior.

Following timers are available in JMeter:

  • Constant Timer
  • Gaussian Random Timer
  • Uniform Random Timer
  • Constant Throughput Timer
  • Synchronizing Timer
  • JSR223 Time
  • BeanShell Time
  • BSF Time
  • Poisson Random Time

We will understand more about Logic controllers by taking an example in coming tutorials.

Assertions

Assertion helps to confirm that your server under test returns the expected result. Assertions allow you to define the pass/fail criteria for your test. You can configure what kind of assertions is active for every test plan. So test assertion is – a condition which compares the expected value with the actual value for a specified test case. One of the most widely used assertion is Response Assertion which allows us to verify the content of the response /status code. Similarly there are several types of assertions that we can use in our tests.

Here is a list of available assertions in JMeter:

  • Response Assertion
  • Bean shell Assertion
  • BSF Assertion
  • Compare Assertion
  • JSR223 Assertion
  • Duration Assertion
  • Size Assertion
  • XML Assertion
  • SMIME Assertion
  • MD5Hex Assertion
  • HTML Assertion
  • XPath Assertion
  • XML Schema Assertion

Lets see how assertions can be added and validated using the above available assertions in JMeter in coming tutorials.

Processors

JMeter element Processor are used to process something (request, custom operations, response) before and after the sampler (request). It basically affect the response time for the request. There are two types of processors in JMeter, Pre-Processors and Post- Processor.

Pre-Processors

A Pre-Processor elements is executed before the sampler and can be used for precondition setup. If a Pre-Processor is added to a test plan, then it will execute just before to that sampler element running. A Pre-Processor is most often used to adjust a Sample Request just before it runs.

Here is a list of available Pre-Processors in JMeter:

  • Bean shell PreProcessor
  • BSF PreProcessor
  • JDBC PreProcessor
  • JSR223 PreProcessor
  • HTML link Parser
  • HTTP URL Re-writing Modifier
  • RegEx Users Parameters
  • Users Parameters
  • Sample Timeout

Post-Processors

A Post-Processor elements is executed after the sampler and can be used for post condition response. If a Pre-Processor is added to a test plan, then it will be executed after response has arrived. A Post-Processor is often used to find out something from response for some actions. These action may be some time to validate response or to extract something and process.

Here is a list of available Post-Processors in JMeter:

  • Regular Expression Extractor
  • XPath Extractor
  • Result Status Action Handler
  • JSR223 PostProcessor
  • JDBC PostProcessor
  • BSF PostProcessor
  • CSS/JQuery Extractor
  • BeanShell PostProcessor
  • Debug PostProcessor

We will discuss more in detail with examples for pre and post processors.

Listener

Listeners facilitates viewers to view responses generated by samplers in the form of tables, graphs, trees or simple text in some log files and also give pictorial access to the data collected by JMeter about those test cases as a Sampler component of JMeter is executed.

Here is a list of available listeners in JMeter:

  • Sample Result Save Configuration
  • Graph Full Results
  • Graph Results
  • Spline Visualizer
  • Assertion Results
  • View Results Tree
  • Aggregate Report
  • View Results in Table
  • Simple Data Writer
  • Monitor Results
  • Distribution Graph (alpha)
  • Aggregate Graph
  • Mailer Visualizer
  • BeanShell Listener
  • Summary Report

We will discuss more in detail with examples for Listeners.

Configuration Elements

Configuration element works closely with a Sampler. Configuration elements has highest priority during execution for example if we set HTTP Request default and HTTP Request inside the Thread Group during execution the topmost priority is given to HTTP Request Default then only to HTTP Request, moreover if there are more than one HTTP Request then they can access defined HTTP Request Default as their definition. Configuration elements are mainly used to set up defaults and variables like cookies, cache etc. for samplers.

Here is a list of available configuration elements in JMeter:

  • Counter
  • Java Request Defaults
  • DNS Cache Manager
  • LDAP Request Defaults
  • LDAP Extended Request Defaults
  • Keystore Configuration
  • JDBC Connection Configuration
  • Login Config Element
  • CSV Data Set Config
  • FTP Request Defaults
  • TCP Sampler Config
  • User Defined Variables
  • HTTP Authorization Manager
  • HTTP Cache Manager
  • HTTP Cookie Manager
  • HTTP Request Defaults
  • HTTP Header Manager
  • Simple Config Element
  • Random Variable

We will discuss more in detail with examples in coming tutorials..

JMeter Tutorials: 

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.