Introduction of Apache JMeter – Open Source Performance Testing Software

Back to Blog
Apache JMeter

Introduction of Apache JMeter – Open Source Performance Testing Software

Apache JMeter is open-source testing software. JMeter is a 100% pure Java desktop application that uses for performance testing and analyzing the overall system performance under different loads.

It is user-friendly and can download for free of cost. JMeter was originally used for testing Web Applications or FTP applications. Today, its uses for functional tests, database server tests, etc.

Many protocols that are supported by Apache JMeter

  1. HTTP, HTTPS sites
  2. Web Services
  3. Database via JDBC drivers
  4. Directory – LDAP
  5. JMS (Java Message Service)
  6. SMTP( Simple Mail Transfer Protocol)
  7. FTP Services( File Transfer Protocol)

JMeter Advantage

  1.         Open source license
  2.         Friendly user interface
  3.         Record and playback feature
  4.         Easy installation
  5.         Multi-threading framework
  6.         Multiple protocols supported

Basic Components of JMeter

1) Test Plan

It is a root feature in the JMeter tool where all the settings are described/mentioned for executing a test. It describes all the steps that JMeter has to execute when tests are run. A test plan consists of Thread Group, Timers, Config Elements, Listener, Assertion, pre/post processors, etc. JMeter offers various customization as it can be used depending upon the user’s requirement.

Basic Components of JMeter

2) Thread Group

Thread Groups can be defined as a collection of Threads. Each thread represents one user using the application under test.

Basically, each and every thread simulates one real user request to the server. The thread group elements are responsible for handling the number of threads. We can manage the following things by using thread groups:

  • Number of threads to run
  • Ramp up time (period of time in seconds, that tells JMeter how long it takes to start all the threads)
  • Number of iterations (Loop count)

Thread Group

3) Sampler

Now, we already know that Thread Groups simulate user requests to the server

But how will a Thread Group understand which type of requests (HTTP, FTP, etc.) it needs to make?

The answer is Samplers

The sampler is responsible for sending a specific type of request to the server. For instance, we can have an HTTP Request Sampler if we need to perform different operations like POST, GET, and DELETE on HTTP services or web applications.

JMeter has a different type of sampler.  HTTP Request Sampler is the sampler used for testing web applications. Samplers do the actual work for JMeter and are responsible for generating one or more sample results. Some majorly used samplers are listed below:

  1. HTTP Request
  2. FTP Request
  3. JDBC Request
  4. Java Request
  5. SOAP/XML Request
  6. SMTP Sampler
  7. BSF Sampler
  8. Debug Sampler

 

Sampler

Sampler 2

4) Listeners

The listener records the results generated by the samplers. Listeners show the results of the test execution. The result can be shown in a different format such as a tree, table, graph, or log file.

Listeners also provide the different response time matrices (average time, minimum time, max time, etc) of a Sampler request. Also, If there are a lot of samplers in a thread group, then the listener may consume a lot of memory.

Read Also:- TestNg Listeners In Selenium Tests

Some listeners provided by Apache JMeter are:

  1. View Results in Table
  2. Graph Results
  3. Assertion Results
  4. View Results Tree
  5. Aggregate Report
  6. Mailer Visualizer
  7. Simple Data Writer
  8. Aggregate Graph
  9. Bean Shell Listener
  10. Summary Report

 

Listeners

5) Assertion

The assertion in JMeter is responsible for validating the response of the request that users have sent to the server. It is a process where you verify the expected result with the actual result of the request at run time. If you need to apply assertion on a particular Sampler, then users have to add it as a child of that Sampler.

Assertion results can view by adding “Assertion Listener” to the Thread Group. If an assertion gets fails, the sampler request mark as fails and the same gets reflects in the test results listeners.

 

Assertion

Some Assertion listeners provided by JMeter are:

  1. Bean Shell Assertion
  2. BSF Assertion
  3. Compare Assertion
  4. Duration Assertion
  5. HTML Assertion
  6. Response Assertion
  7. Size Assertion
  8. SMIME Assertion
  9. XML Assertion
  10. XML Schema Assertion
  11. XPath Assertion

How to add Assertion:

Simply, Right Click on a Sampler Request -> Hover over Add -> Hover Over the desired Assertion -> Click on the required Assertion

How to add Assertion

Running Test Plan

Once the sampler(s) are ready, we can add a couple of reporting elements(Listeners) to gather statistics at runtime, and start the load test.

In the screenshot below, while our test is running, we can monitor the following things

  1.         Test Plan
  2.         Thread Group
  3.         Samplers – Registration
  4.         Assertion – Response Assertion
  5.         Listeners – View Result Tree, Summary Report

 

Running Test Plan

 

Share this post

Back to Blog