Performance Test of Web Application using Apache JMeter

2019-05-30 : BY CLICK2CLOUD-BLOG

Apache JMeter is one of the best open source tools for Load and Performance testing. It can be widely used for a variety of applications. It is designed to load test functional behavior and measure performance.

JMeter is a Java desktop application with a graphical interface that uses the Swing graphical API. It can, therefore, run on any environment/workstation that accepts a Java virtual machine, for example, − Windows, Linux, Mac, etc.


What can we do with it?

Apache JMeter may be used to test performance both on static and dynamic resources, Web dynamic applications. It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types.

Running JMeter

There are three modes to start JMeter

GUI Mode: It can be used for recording test script and running their script to JMeter itself. Run the Jmeter.bat file for Windows system and JMeter file for Linux. These files are found in the bin folder. After that, the JMeter GUI will appear.

Command Line Mode (Non-GUI): For load testing, use this mode to get optimal results.

Server Mode: For distributed testing, use this mode to run JMeter in Sever on the remote node and control the servers from GUI.

How does JMeter work?

JMeter simulates a group of users sending requests to a target server and return statistics information of target server through graphical diagrams.

Let’s have a look at the different steps performed by JMeter during testing:

  • It creates a request and sends to the server.
  • It receives the response from the server, collects them and visualizes those details in a chart or graph.
  • It processes the response from the server.
  • It generates the test result in several formats such as text, XML, JSON so that the tester can analyze data.

The workflow of JMeter as shown in the figure below,

Apache JMeter features

  • Ability to load and performance test many different applications/server/protocol types:
      • Web – HTTP, HTTPS (Java, NodeJS, PHP, ASP.NET, …)
      • SOAP / REST Webservices
    • FTP
    • Database via JDBC
    • LDAP
    • Message-oriented middleware (MOM) via JMS
    • Mail – SMTP(S), POP3(S) and IMAP(S)
    • Native commands or shell scripts
    • TCP
    • Java Objects
  • Full-featured Test IDE that allows fast Test Plan recording (from Browsers or native applications), building and debugging.
  • CLI mode (Command-line mode (previously called Non-GUI) / headless mode) to load test from any Java-compatible OS (Linux, Windows, Mac OSX, …)
  • A complete and ready to present dynamic HTML report
  • Reporting: For reporting purposes, JMeter offers several possibilities. Most common is the View Results Tree. This tree will display the requests and has the ability to show the request and the response. The response can be displayed as text, XML, HTML or JSON. The component View Results Tree is mostly used for functional testing.

i) Summary Report

ii) Graphical report

iii) Tabular report

  • Complete portability and 100% Java purity.
  • Full multithreading framework allows concurrent sampling by many threads and simultaneous sampling of different functions by separate thread groups.
  • Caching and offline analysis/replaying of test results.
  • Highly Extensible core:
    • Pluggable Samplers allow unlimited testing capabilities.
    • Scriptable Samplers (JSR223-compatible languages like Groovy and Bean Shell)
    • Several load statistics may be chosen with pluggable timers.
    • Data analysis and visualization plugins allow great extensibility as well as personalization.
    • Functions can be used to provide dynamic input to a test or provide data manipulation.
    • Easy Continuous Integration through 3rd party Open Source libraries for Maven, Gradle, and Jenkins.

Advantages of using JMeter

  • Open Source: JMeter is an open source software. This means that it can be downloaded free of cost. It is also a 100% pure Java application. The developer can use its source code, can modify and customize it as per their requirement. They can also contribute their code to make a better JMeter.
  • Ease of Use: The user can install and use JMeter easily. Just download it from the internet, install and run. As a pure Java desktop application, it comes ready to use with default settings. It does not require you to have any specific skills or domain knowledge to use it. Follow the link below to download Jmeter

  • Platform independent: JMeter is developed in Java, which is the most popular programming language in the world. Therefore, it can run in any OS be it Window, Linux or Mac.
  • Robust Reporting: JMeter can generate effective reporting. The test result can be visualized by using Graph, Chart, and Tree View. JMeter supports different formats for reporting like text, XML, HTML, and JSON.
  • Ultimate Testing: With JMeter, user can do any kind of testing they want. Load Test, Stress Test, Functional Test, Distributed Test, all in one tool.
  • Flexibility: You can customize JMeter as per your requirement and apply the automation testing to JMeter. You can save the effort of executing test cases manually.
  • Multi-Protocol Support: JMeter supports several protocols like HTTP, FTP, SOAP, JDBC, JMS, and LDAP. It can also be used for testing the performance of your database.

Limitations of using JMeter

  • Memory Consumption: JMeter can simulate heavy load and visualize the test report. This may consume lots of memory and can lead out of memory under heavy load.
  • Web application only: JMeter is a good tool for testing web application but it is not a suitable tool for a testing desktop application.
  • Lack of support for JavaScript: JMeter is not a browser, so it cannot run JavaScript in the web application. It has limited support for processing JavaScript or Ajax, this may affect the accuracy of the simulation.

JMeter is not a browser

JMeter is not a browser, it works at the protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however, JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the JavaScript found in HTML pages. Nor does it render the HTML pages as a browser does (it’s possible to view the response as HTML etc.