Introduction to JMETER

05 / Jan / 2017 by Vikrant Kumar 0 comments

BASICS OF JMETER

Apache Jmeter is an open source testing software. Jmeter is 100% pure Java desktop application used for performance testing and evaluating the overall system performance under different loads. Jmeter is easy to use and can be downloaded for free of cost. It can work with many types of tests categories such as load, performance, functional, regression, etc. Jmeter is compatible with JDK 5 or the higher versions of JDK. By Using Jmeter we can make an application robust and reliable.

Many protocols that are served or supported by Jmeter:

  • HTTP, HTTPS sites
  • Web Services
  • Database via JDBC drivers
  • Directory – LDAP
  • JMS
  • SMTP
  • FTP Services

Some Additional Features of Jmeter:

  • Available free of cost as it is an open source software.
  • Simple and user-friendly GUI, even a layman with little information about Jmeter can use it.
  • Capable of conducting performance and load test for different servers like HTTP, HTTPS, SOAP, Mail- POP3, LDAP etc.
  • Jmeter is a platform independent application. On windows, testing on Jmeter can be initiated using the jmeter.bat file, and on Unix/Linux, by clicking on Jmeter Shell Scripts.
  • Jmeter creates and stores its test plan in XML format. That indicates that we can generate or create a test plan using a text editor.
  • Jmeter is a multi-threading framework which is used for concurrent sampling using multiple threads.
  • It is also helpful in automated functional testing.

Basic Components of Jmeter:

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

It is not mandatory to save a test plan before running a script because Jmeter will ask the user to save test plan while executing the script. But it is a good practice if we save a test plan before running the script.

Jmeter test plan

Workbench: This is like working area. Items present on the workbench:

  • HTTP Proxy Server
  • Config Element
  • Property Display
  • Logic Controller
  • HTTP Mirror Server
  • Assertions & Listener etc

HTTP Proxy Server listens to the requests sent from the web browser to the server. It automatically creates HTTP Request samplers for every request sent to the server.

work bench

Thread Group: Thread group elements are the starting points of our test plan. As it goes straight with the name. The thread group elements handle the number of threads Jmeter will execute during the test run against the application. We can manage following things by using thread group:

  • Number of thread to run
  • Ramp Up time (how long it will take to start all the threads)
  • Number of iteration (Loop count)
  • Scheduler (it is optional)

Jmeter Thread Group

 

Sampler: Sampler is responsible for sending a specific type of request to the server. Samplers produce a user request for a page from the target 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 produce or generate one or more sample results. The sample results can be viewed in different listeners. Some majorly used samplers are listed below:

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

Jmeter Samplers

 

Assertion: Assertion is something which is executed after every sampler is in the scope. These are extra checks performed on samplers. It facilitates users to test the proof about the responses received from the application under test. Moreover, we may use assertions for high volume load testing where the user expectation is to determine how much load an application can handle before crashing. To apply assertion to a particular sampler, it is added as the child of that particular sampler. If an assertion fails while running a script, then Jmeter highlights that assertion.

Some assertions are listed below:-

  • Beanshell Assertion
  • BSF Assertion
  • Compare Assertion
  • JSR223 Assertion
  • Response Assertion
  • Duration Assertion
  • Size Assertion
  • XML Assertion
  • BeanShell Assertion
  • MD5Hex Assertion
  • HTML Assertion
  • XPath Assertion
  • XML Schema Assertion

Jmeter Assertions

 

Logic Controller: Logic controller lets you control the order in which samplers are processed. If a request is coming from child elements of a sampler, then using logic controllers we can change the order of requests. Logic controllers provide a procedure for managing the flow of thread group. Having a logic controller in the thread group is like having an if-then or do-while logic in a program.

Logic controllers are listed below:

  • 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
  • Critical Section Controller
  • jp@gc – Parameterized Controller

Jmeter Logic Controllers

 

Listener: listener records the results generated by the samplers. We can see these results in the form of graphs, tables, trees, or simple text in some particular case. In other words, they provide a visual form to the data gathered by Jmeter after executing as sampler component. Many of the listeners perform several tasks in addition to “listening” to the test results. They also provide a way to view, save, and read saved test results. Listener records the test result of the sampler component which is at or below its level. If there are a lot of samplers in a thread group, then listener may consume a lot of memory. Most of the listeners now-a-days keep a local copy of every sample in their scope.

Some listeners provided by Jmeter are:

  • 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

jmeter Listener

 

JMeter is used to reduce bottlenecks and improve the web server application. Here is another interesting use case on performing load testing using Jmeter.

This blog serves only as a starting point of learning JMeter; there is much more to learn and to do. Keep exploring.

 

FOUND THIS USEFUL? SHARE IT

Leave a Reply

Your email address will not be published. Required fields are marked *