Performance Testing Using JMeter
If you’ve ever done performance testing on a website, you know that there is not really an effective way to manually create enough load on that website.
Getting actual users to execute web application operations over and again is nearly impossible. For that, we need virtual users that can open multiple connections in parallel.
When bulk users attempt to access a website (say commercial websites) at the same time, there are high chances that the website suffers slowness and poor usability. Speed is one of the most important attributes of an application. A slow running application will lose many of its potential users.
Performance testing is done to ensure that the web application performs well under their expected workload.
In today’s competitive world, support for features and functionalities are not the only priority, the speed with which the website responds is also of great concern. The goal of performance testing is not to find bugs, but to eliminate the performance bottlenecks. A web application attributes like its response time, reliability, source usage and scalability do matter a lot. So, in order to test different aspects of a web application, we must test it in different ways. Different performance testing types are as follows:
Different Types of Performance Testing
Load testing is performed to determine how a system behaves when multiple users access it simultaneously.
Stress Testing is done to ensure that the system would not crash in difficult situations.
Endurance testing is done to evaluate how the system behaves when a significant load is applied over a long period of time.
In Spike testing, the web application is tested with extreme increments and decrements in the load.
Volume and scalability
Volume testing describes the ability of an application to handle additional user loads without affecting the performance. Scalability test is done to find the minimum and maximum loads at software, hardware and database levels. This gives the idea that the system is scalable after a load.
There are many robust testing tools available in the market that are capable to handle the various types of performance testing. Few of them have become the industry standard. The recent trend shows that most of the big players in the industry have taken tools like JMeter for all their performance testing needs.
Apache JMeter is a load testing tool that is based on Java. This open source software is used for testing the performance of most of the web-based applications. Performance is an inevitable factor for both mobile and web application as the user strength is very huge.
Advantages of JMeter
- Open source and built-in Java platform. It is highly extensible and platform-independent.
- User-friendly- JMeter has got comprehensive GUI and it can easily create a test plan and configure the elements.
- Support- Basically JMeter is designed for performance testing. But it can also be used for non-functional testing such as stress, distributed and web service testing by creating a test plan.
JMeter provides support for protocols such as FTP, SOAP, JDBC, HTTP
- Documentation- Because of its robust documentation, user can have a clear idea on every step starting from the installation and configuration of test settings and generating the final report.
- Recording- JMeter allows the user to record HTTP or HTTPS to create test plan using the recording facility. It uses a proxy server that allows JMeter to watch and record user actions while the user browses the web application with any normal browser. Once the recording is complete, we enter the number of threads, time and Start test. It is advisable to use the Non-GUI mode of JMeter if the user count is large.
- Reporting- JMeter supports dashboard report generation. These reports help the user to understand test execution results.
Installation of JMeter
Before installing JMeter, it is essential to check that Java is installed in the system. JMeter is a pure Java desktop application. It needs fully compliant JVM 6 or higher to perform its tasks. User can download and install the latest version of the Java SE Development Kit.
The latest version of JMeter available is JMeter 5.1
JMeter can be downloaded from the official website Apache.
From this website, user can download JMeter PGP or zip file under the Binaries section and then unzip the zip file into the directory where JMeter is to be installed. JMeter directory structure includes the following directories and files.
- Bin: holds JMeter script file to start JMeter
- Docs: holds JMeter documentation files
- Extras: related extra files
- Lib: holds the required Java library for JMeter
- Lib/ext: includes core jar files for JMeter and its protocols
A test plan is stored in XML format.
Elements of JMeter
Thread group is the collection of threads. Each thread represents 1 user using the application under test. Basically, each thread simulates 1 real user request to the server.
Samplers indicate which type of request is sent to the server. It can be HTTP, FTP, JDBC requests.
Listeners display the result of test execution. It can show the result in different formats such as tree, table, summary report, log files and graphs.
Config elements in JMeter are used to configure the sampler requests sent to the server. Commonly used config elements are CSV data set config, HTTP Cookie Manager, Login Config Element HTTP Request Defaults and FTP Request Defaults.
It is used to validate the response of the request that the user sent to the server. Here user can verify the expected result with the actual result. If a user wants to check assertion of a sampler, then assertion must be added as child of that sampler. User can view Assertion result by adding Assertion Listener to the thread group.
Testing in non-GUI method
In non-GUI mode, JMeter can handle more requests per second. Increasing threads after a certain limit will result in JMeter crash in GUI mode. The following command is used to run the test plan in non-GUI mode.
|jmeter -n -t <test JMX file> -l <test log file> -e -o <path to output folder>|
A result log file can be generated in CSV or JTL format after running the load test.
Hope this article gave a real insight into the importance of performance testing in today’s web world and how modern testing tools like JMeter helps you to execute performance testing efficiently.
Happy Performance testing!
Notice: Theme without comments.php is deprecated since version 3.0.0 with no alternative available. Please include a comments.php template in your theme. in /var/www/vhosts/baltoncp.com/alignminds.com/wp-includes/functions.php on line 4805