Introduction of Apache JMeter — Open Source Performance Testing Software | Devstringx Technologies

JMeter

Apache JMeter is an open source testing software. JMeter is a 100% pure Java desktop application which is used for performance testing and analyze the overall system performance under different loads.

JMeter is user friendly and can be downloaded for free of cost. JMeter was originally used for testing Web Application or FTP application, today it is used for a functional test, database server test etc.

Many protocols that are supported by JMeter:

  • HTTP, HTTPS sites
  • Web Services
  • Database via JDBC drivers
  • Directory — LDAP
  • JMS (Java Message Service)
  • SMTP( Simple Mail Transfer Protocol)
  • FTP Services( File Transfer Protocol)

JMeter Advantage:

  • Open source license
  • Friendly user interface
  • Record and playback feature
  • Easy installation
  • Multi-threading framework
  • Multiple protocol supported

Basic Components of JMeter:

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

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 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 iteration (Loop count)

Sampler: Now, we already know that Thread Groups simulate user request to the server

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

The answer is Samplers

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, 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:

  • HTTP Request
  • FTP Request
  • JDBC Request
  • Java Request
  • SOAP/XML Request
  • SMTP Sampler
  • BSF Sampler
  • Debug Sampler

Listeners: 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 listener may consume a lot of memory.

Some listeners provided by JMeter are:

  • View Results in Table
  • Graph Results
  • Assertion Results
  • View Results Tree
  • Aggregate Report
  • Mailer Visualizer
  • Simple Data Writer
  • Aggregate Graph
  • Bean Shell Listener
  • Summary Report

Assertion: 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 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 be viewed by adding “Assertion Listener” to the Thread Group. If an assertion gets fail, the sampler request is marked as failed and the same gets reflected in the test results listeners.

Some Assertion listeners provided by JMeter are:

  • Bean Shell Assertion
  • BSF Assertion
  • Compare Assertion
  • Duration Assertion
  • HTML Assertion
  • Response Assertion
  • Size Assertion
  • SMIME Assertion
  • XML Assertion
  • XML Schema Assertion
  • XPath Assertion

How to add Assertion:

Simply, Right Click on a Sampler Request -> Hover over Add -> Hover Over desired Assertion -> Click on the required 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

  • Test Plan
  • Thread Group
  • Samplers — Registration
  • Assertion — Response Assertion
  • Listeners — View Result Tree, Summary Report

Originally published at https://www.devstringx.com on January 21, 2020.

Devstringx Technologies is highly recommended IT company for custom software development, mobile app development and automation testing services