JMeter is one of most popular performance testing tool and since it is open-source, therefore it is often a start point for beginners in performance testing. In this blog, I will share a step-by-step guide that can be used to install JMeter in Windows environment. There will also be some configuration and script designing tips which you will find useful while working on real-time JMeter projects.
Apache JMeter is purely a Java based tool; therefore first of all we need to make sure that Java is properly installed and configured in our system. If you are already using any java based applications, then Java might already be installed on your system. To check if Java is already installed open command prompt and run command java -version.
If Java is successfully installed and configured then the command will return valid java version number (java version “x.x.x.x”) as shown in image below:
If Java is not installed or configured, then you may get a message like this: "java" is not recognized as an internal or external command, operable program or batch file.
To fix it, you need to download and install valid java JRE or JDK corresponding to your operating system. Java JRE or JDK can be download from Java Download Page on Oracle website. After successful installation of JRE/JDK, open command prompt again and run the command java -version . It should now return java version number that you installed. If you still do not get the valid response after above steps, then you may look into setting java environment variables under windows system properties.
It is very important to have correct version of java on your system to get maximum out of JMeter. For example, using a 32 bit java on a 64 bit operating system can lead to under-utilization of resources.
To download JMeter simply go to official Apache JMeter website and download the zip or tgz package.
Apache JMeter Download
After downloading the file, just unzip it anywhere in your system. In the unzipped folder there are all the files which JMeter requires for its functioning.
There are many ways to optimize JMeter for better performance. It is a complete topic in itself but for starter, I will recommend at least configuring java xms and xmx values in JMeter.bat file. By doing so, you can make sure that JMeter is properly using the available memory resources. It also reduces the chances of Out Of Memory errors.
To change these settings, open jmeter.bat file in notepad and update following lines
Other than this configuration, it is also important to use listeners intelligently in your test plan. Listeners that consume more memory like Table, Tree, Assertion and Graph listeners should be avoided during actual load test execution. It is best to only generate JTL test results file during actual load tests and later that JTL file can be used to create different
There are multiple ways to start JMeter. We can start it in GUI mode by opening jmeter.bat file or we can simply run commands in CMD to execute jmeter scripts without opening it in GUI mode.
4.1) To open JMeter GUI, just navigate to apache-jmeter-3.0>bin directory and double-click ApacheJMeter.jar or jmeter.bat file.
Steps to launch JMeter GUI
It should open up JMeter in GUI mode as in image below:
4.2) As discussed earlier, JMeter consumes lot of system resources while running in GUI mode. Therefore, it is best to use it in command-line non-GUI mode while performing actual load tests. JMeter scripts can be executed from CMD by using command below:
jmeter -n -t myScript.jmx
There are other parameter as well which you can pass along with command like path to JTL results file, server IP and port number etc. Command prompt will show progress messages during the script execution and also a summary after successful execution of script.
Still facing any issues while setting up JMeter? Feel free to ask and I will try my best to help out.
1- Setup and Verify Java
Apache JMeter is purely a Java based tool; therefore first of all we need to make sure that Java is properly installed and configured in our system. If you are already using any java based applications, then Java might already be installed on your system. To check if Java is already installed open command prompt and run command java -version.
If Java is successfully installed and configured then the command will return valid java version number (java version “x.x.x.x”) as shown in image below:
If Java is not installed or configured, then you may get a message like this: "java" is not recognized as an internal or external command, operable program or batch file.
To fix it, you need to download and install valid java JRE or JDK corresponding to your operating system. Java JRE or JDK can be download from Java Download Page on Oracle website. After successful installation of JRE/JDK, open command prompt again and run the command java -version . It should now return java version number that you installed. If you still do not get the valid response after above steps, then you may look into setting java environment variables under windows system properties.
It is very important to have correct version of java on your system to get maximum out of JMeter. For example, using a 32 bit java on a 64 bit operating system can lead to under-utilization of resources.
2- Download and Install JMeter
To download JMeter simply go to official Apache JMeter website and download the zip or tgz package.
Apache JMeter Download
After downloading the file, just unzip it anywhere in your system. In the unzipped folder there are all the files which JMeter requires for its functioning.
3- Configure JMeter for better performance
To change these settings, open jmeter.bat file in notepad and update following lines
Other than this configuration, it is also important to use listeners intelligently in your test plan. Listeners that consume more memory like Table, Tree, Assertion and Graph listeners should be avoided during actual load test execution. It is best to only generate JTL test results file during actual load tests and later that JTL file can be used to create different
reports.
4- Launch JMeter & Execute JMeter scripts
4.1) To open JMeter GUI, just navigate to apache-jmeter-3.0>bin directory and double-click ApacheJMeter.jar or jmeter.bat file.
Steps to launch JMeter GUI
It should open up JMeter in GUI mode as in image below:
4.2) As discussed earlier, JMeter consumes lot of system resources while running in GUI mode. Therefore, it is best to use it in command-line non-GUI mode while performing actual load tests. JMeter scripts can be executed from CMD by using command below:
jmeter -n -t myScript.jmx
There are other parameter as well which you can pass along with command like path to JTL results file, server IP and port number etc. Command prompt will show progress messages during the script execution and also a summary after successful execution of script.
Still facing any issues while setting up JMeter? Feel free to ask and I will try my best to help out.
Sure, but please add my blog link into your content or anywhere, For more detail please click and view softwareqatestings.blogspot.com
ReplyDelete