JMeter Test Plan and Components

In this tutorial, I will describe JMeter Test Plan and Components.

Outline of JMeter Test Plan and Components

  • Test Plan
  • Test Group
  • Controllers
  • Listeners
  • Timers

JMeter Test Plan

Test Plan is the root element of JMeter structure and it contains other elements like Threads, Timers, Assertions, Listeners.

test_plan

JMeter Thread Group

Thread Group is used for specifying the number of running threads, ramp-up period, and loop count. It represents a group of users who will execute a particular test case.

thread group

The number of Threads (Users) simulates the number of users or connections to your server application.

Loop Count means how many times to execute the test.

Ramp-up defines how long it will take JMeter to get all threads running. For example, if there are 6 threads and the ramp-up period is 60 seconds, then each thread will delay (60/6) 10 seconds. After 60 seconds, all threads will run.

ThreadGroup_ramp_up

Scheduler check-box means that your test will not be executed until the start date.

jmeter_schedular

JMeter Controllers

JMeter has 2 types of controllers Sampler and Logical controllers.

Sampler:  JMeter provides different requests to send to the server. We can change and configure all these samplers.

Default sampler  list:

default_samplers

Logical: which helps you to customize your request logic. You can find the latest logical controllers list provided by JMeter.

logic_controllers

JMeter Listeners

Let us see the results of the test in different formats. Let’s gather the data and analyze the results of the tests.

If you click on the “Configure” button

listener_result

Provides different formats to save results (CSV, XML)

You can change the default format, find the following line in jmeter.properties:

jmeter.save.saveservice.output_format=

Listeners collect data only from elements at their below elements.

By default, the results are stored as XML files, typically with a “.jtl” extension.

results_tree

Listeners can use lots of memory so they should not be used in real tests. It is better to use them only for debugging.

Keep in mind that there are some suggestions on reducing resource usage on the JMeter official website.

  • Use non-GUI mode: jmeter -n -t test.jmx -l test.jtl
  • Use as few Listeners as possible; if using the -l flag as above they can all be deleted or disabled.
  • Don’t use “View Results Tree” or “View Results in Table” listeners during the load test, use them only during the scripting phase to debug your scripts.
  • Rather than using lots of similar samplers, use the same sampler in a loop, and use variables (CSV Data Set) to vary the sample. [The Include Controller does not help here, as it adds all the test elements in the file to the test plan.]
  • Don’t use functional mode
  • Use CSV output rather than XML
  • Only save the data that you need
  • Use as few Assertions as possible
  • Use the most performing scripting language (see JSR223 section)  (jmeter.apache.org)

JMeter Timers

JMeter sends requests without any pause between each request by default. Thus, timers make test scenarios more realistic, they pause every request certain amount of time. In the below figure you can see that there is a 3000 ms delay between the two requests.

timers

Thanks.
Onur Yazir

1 thought on “JMeter Test Plan and Components”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.