Interview Questions, Answers and Tutorials

JMeter Tutorial – Test Plan Elements

JMeter Tutorial – Test Plan Elements

A JMeter Test Plan comprises of test elements which are discussed below. A Test Plan would comprise at least one Thread Group. Within each Thread Group, we may place a combination of one or more other elements: Sampler, Logic Controller, Configuration Element, Listener, and Timer. Each Sampler can be preceded by one or more Pre-processor elements, followed by a Post-processor element, and/or Assertion element. Let’s see each of these elements in detail: 

ThreadGroup

Thread Group elements are the beginning points of your test plan. As the name suggests, the thread group elements control the number of threads JMeter will use during the test. We can also control the following via the Thread Group:

  • By setting the number of Threads.
  • By setting the Ramp-Up Time
  • By setting the number of test iterations.


The Thread Group Control Panel looks like this:

Details of each component on the above panel are:

  1. Action to be taken after a Sampler error: In case any error occurs during test execution you may let the test either:
  • Continue to the next element in the test
  • Stop Thread to stop the current Thread.
  • Stop Test completely, in case you want to inspect the error before continue running.
  1. Number of Threads: Simulates the number of the user(s) or connection(s) to your server application.
  2. Ramp-Up Period: Defines how long it will take JMeter to get all threads running.
  3. Loop Count: Defines the number of times to execute the test.
  4. Scheduler checkbox Once selected, the Scheduler Configuration section will appear at the bottom of the control panel.
  5. Scheduler Configuration You can configure the start and end times of running the test.

Controllers

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

Samplers allow JMeter to send specific types of requests to a server. They simulate a user’s request for a page from the target server. For example, you can add an HTTP Request sampler if you need to perform a POST, GET, DELETE on an HTTP service

Some useful samplers are:

  • HTTP Request
  • FTP Request
  • JDBC Request
  • Java Request
  • SOAP/XML Request
  • RPC Requests


An HTTP Request Sampler Control Panel looks like the following figure: