This is the first tutorial in our JMeter performance testing tutorial series. We have covered almost all the basic and advanced JMeter topics in this 3-part text tutorial and 23-part video tutorial series.
In this tutorial, we are going to learn what performance testing is, why JMeter, JMeter download and installation, and JMeter vs HP LoadRunner.
What You Will Learn:
Performance Testing with JMeter
Performance Testing is the “Talk of today”. You all know what I mean!! Yes, performance testing has become one of the most important expectations of clients. With such a fast-paced life, no one wants an app that works even a bit slower than the expected benchmark.
We have such an enormous competition in a market that we cannot afford to miss the “P” concept in a testing life cycle.
Before we move on to exploring Jmeter and its installation process, we need to know what performance testing is and how JMeter as a tool supports performance testing.
Performance: Just as students need to perform well to get themselves promoted to the next level. In the same way, your application (mobile or the web or desktop) needs to perform well to move to the next level in a market where there are a lot of competitors.
Performance testing measures how well your application is performing under a different workload. There are many parameters which are considered to determine if the server under load test is behaving well and those will be discussed later in the article.
- Let’s take a simple example. I typed “www.facebook.com” in my browser and it displayed the Facebook’s home page in approx. 10 seconds. Now say 1000 people typed “www.facebook.com” and hit at the same time and the Google home page gets displayed in maybe more than 10 seconds.
- So, the performance changes under different workloads (number of users). This type of testing is of utmost importance as no matter how good the design and functionalities you have in your application, but if its performance is poor then you have a high chance of losing all your potential target audience.
Please refer to the diagram below for more clarity:
Performance Testing majorly considers the below parameters:
- Throughput– It is defined as the number of transactions per second. For example, let’s say bank customer care can handle only 30 calls at a time, so the rest of callers get in a queue. This means that the Throughput is 30
- Response Time – This time is the time taken by the user to receive a response from the server
- Latency is the time in which the first byte of information reaches the user end. For example, it says a user hits an HTTP request to retrieve a web page. So, the time in which the first byte of that webpage is received is the latency of that request
- Scalability – It refers to the maximum load an application can withstand.
- CPU Loading, Memory Usage, and Resource Usage
What is JMeter?
JMeter was first developed by Stefano Mazzocchi of Apache Software. Basically, JMeter is a Java based desktop application. JMeter uses Swing Graphical API which means that it is not implemented by platform-specific coding.
Therefore, JMeter can run on windows, Linux, Mac etc. Apache JMeter 3.1 is the latest version available in the market as of now with some more enhancements lined up for the future.
Below are some of the protocols supported by JMeter:
- HTTP and HTTPS
- SMTP and IMAP
How about JMeter?
Since we have a market flooded with performance testing tools such as LoadRunner, Rational Performance Testing, VSTS and much more, there are many reasons which push companies and QA teams to go for JMeter as their primary tool for measuring performance.
Below are some of the reasons which make JMeter outweigh other tools in the market:
- Free Tool – JMeter is a free tool and is easily available on the Apache website
- The User-Friendly Interface – JMeter’s interface is highly user-friendly and testers can easily get themselves familiar with a majority of its components. Help documentation for every component is available inside the tool
- Highly Extensible – User can create his own sampler (a type of request) using JSR223 and there are many plugins for Samplers available which allow testers to increase testing capabilities
- Protocols Support – JMeter is not only used for application performance testing, it supports all major protocols such as FTP, HTTP, JDBC, LDAP, SOAP etc.
- Recording Feature – JMeter has an inbuilt HTTP(S) Test Script Recorder which can be used to record all actions from a website or mobile app and then load can be simulated to test performance under various load conditions. Also, there is a chrome extension available to record the actions and then the same script can be used in JMeter to scale the load
- Integration with Selenium – You can also integrate JMeter with Selenium for Automation testing
- Simple Installation – Installing a JMeter is very easy. You need to have Java Installed on your machine, download JMeter and run the .bat file
- Reports – JMeter provides the tree, graphs, and table representation of results which can be utilized as per your project demand
Installation of JMeter
Installation of JMeter is very easy. Before installing JMeter, please see the prerequisites below:
- Ensure that you have Java installed on your machine. To verify the version of Java which is installed, go to the command prompt and type java – version
If Java is not Installed:
- If you don’t have Java Installed then go to https://java.com/en/download/ and download the latest JDK version from there. Install Java with package installer
- Once Java is installed, you need to set the JAVA_HOME variable
Follow the steps below to set your JAVA_HOME
- Check for the directory where Java is installed. Usually, it would be installed somewhere in “C:\Program Files\Java\jdk1.8.0_112”
- Right, Click on “My Computer” and open the properties window
- Click the Environment Variables button
- In the System Variables section, click New
- Enter JAVA_HOME in variable name text field
- For the Variable Value Text field, enter the JDK/JRE installation path. For example, “C:\Program Files\Java\jdk1.8.0_112” in my case
- Click OK
A screenshot below for your reference:
(Note: Click on any image for an enlarged view)
- Select the .zip file and download the JMeter file
- Unzip the folder to your computer
- Go to the Bin folder inside your JMeter folder and launch the .bat file
- The batch file will run for a second and then your JMeter UI will be launched. See below for reference
- The above steps complete the JMeter installation process. Make sure that you do not close the .exe file as that will also close the JMeter UI
Common Errors in the JMeter Installation Process
Since JMeter installation is quite simple and we don’t need to run any packages or set any paths while installing the tool, hence you won’t face any error until you download and unzipping the folder. Common issues faced are only at the time of launching JMeter using a .bat file.
“Not able to find Java executable or version” is observed.
Below are some of the possible resolutions to make that work:
- Check the PATH variable in the Environment settings and verify that the directory containing your java.exe is there in the path
- Right click on the .bat JMeter file and select “Run as Administrator”, it works sometimes
Components of JMeter
- Test Plan
- Config Element
- Post Processor
- Logic Controllers
- HTTP (S) Script Recorder
HP LoadRunner v/s JMeter
The market is flooded with performance testing tools such as NeoLoad, Load Runner, VSTS etc. Hence, it is of utmost importance to know where JMeter fits in. Load Runner is a major player in terms of performance testing due to its extensively high technical support but it is a highly paid tool with one license costing too much for a small-scale enterprise.
Below are some of the differences between LoadRunner and JMeter which makes JMeter an obvious choice for the majority.
|Open Source tool and free to use||HP Product and license is very costly. Small enterprises cannot afford.|
|Protocols support is limited.||Load Runner has the highest protocols support.|
|Jmeter is a Java based product and uses sprint based API which makes it platform independent and can run on any environment be it win, mac, Linux.||It uses C based language, Java, Java Script and VB.|
|Load Generation capacity is limited. On a machine with high RAM and processor, Jmeter can generate load of 1-2k users only. Putting more load may results in out of memory exceptions.||Load Generation capacity is higher as compared to Jmeter.|
|Technical proficiency is less in Jmeter.||LoadRunner is highly technical proficient.|
|Jmeter has lots of complexities running in cloud.||Load Runner is easily runnable in cloud environment too.|
|Recording feature in Jmeter is very easy and supports extensibility too. There are chrome plugins from where scripts can be directly imported in Jmeter.||Recording feature in Load Runner is little complex as compared to Jmeter.|
|Jmeter's results are not the real-time ones.||LoadRunner provides comparatively more real time results|
|Jmeter is not that efficient when used for enterprise products like SAP.||Load Runner provides efficient results even with SAP, Siebel etc.|
JMeter is a powerful tool in the market for testing web and mobile applications. It is very easy to use and doesn’t require much programming skills unless one is writing his own samplers in JMeter. We will be covering the details of each component in the upcoming series of articles.
About the Author: Thanks to Hasneet for creating this wonderful JMeter tutorial training series. He is working as a Quality Assurance Lead with 5+ years of extensive experience working on various testing projects.
Continue to Part II – The second part of this tutorial is on the “JMeter Components In Details”.
Please share your comments or questions with us.
=> Click here for the JMeter Tutorials: Complete Free Training On JMeter (20+ Videos)