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 is performance testing, why JMeter, JMeter download and installation, and JMeter vs HP LoadRunner.
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 pace life, no one wants an app that even works 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 explore Jmeter and its installation process, we need to know what is performance testing and how JMeter as a tool supports performance testing.
Performance: Just as students need to perform well to get themselves promoted to next level. In the same way, your application (mobile or the web or desktop) needs to perform well to move 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 Google home page gets displayed in may be more than 10 seconds
- So, the performance changes under difference workload (number of users). This type of testing is utmost important as no matter how good design and functionalities you have in your application but if its performance is poor then you have high chances of losing all your potential target audience
Please refer to the diagram below for more clarity:
Performance Testing majorly considers below parameters:
- Throughput– It is defined as a number of transactions per second. For Example, let’s say a bank customer care can handle only 30 calls at a time, so rest of callers get in a queue. It means that the Throughput is 30
- Response Time – This time is the time taken by the user to receive the response from the server
- Latency is the time in which the first byte of information reaches the user end. For example, 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 Load, Memory Usage, and Resource Usage
What You Will Learn:
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 future.
Below are some of the protocols supported by JMeter:
- HTTP, HTTPS
- SMTP, IMAP
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 Apache website
- 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 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 JMeter is very easy. You need to have Java Installed on your machine and download JMeter and run the .bat file
- Reports – JMeter provides the tree, graphs, 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 command prompt and type java – version
If Java is not Installed:
- In Case you don’t have Java Installed then go to https://java.com/en/download/ and download the latest JDK version from there. Install the Java with package installer
- Once Java is installed, you need to set the JAVA_HOME variable
Follow the below steps 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 properties window
- Click the Environment Variables button
- In System Variables section, click New
- Enter JAVA_HOME in variable name text field
- For Variable Value Text field, enter 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 enlarged view)
- Select a .zip file and download the JMeter file
- Unzip the folder to your computer
- Go to 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
- Above steps complete JMeter installation process. Make sure that you do not close the .exe file as that will also close JMeter UI
Common Errors in JMeter Installation
Since JMeter installation is quite simple and we don’t need to run any package or set any path while installing tool, hence you won’t face any error till download and unzipping 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 that PATH variable in 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
A market is flooded with performance testing tools such as NeoLoad, Load Runner, VSTS etc. hence it is utmost important to know where does 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 difference 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 the 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 details of each component in 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.