JMeter is a well known open source load testing tool which is utilized in many software companies. Due to it’s long list of supported protocols, it is very useful tool and used in various scenarios apart from Load Testing. In today’s article, I will be focusing on how to run JMeter in Non-GUI Mode.
Doing load testing is CPU intensive process which requires good memory and processing power. JMeter comes with user interface which is built to simplify the process of load test plan creation. Many users thinks of running a load test using user interface as it provides some goods listeners to monitor the test. But, it’s not a good idea as the system generates logs and resulting while test is running which can drain your computer CPU and the load test will be hung in between.
To overcome these issues, it is advised to run JMeter in Non-GUI Mode. It’s possible to run a JMeter test using command prompt. JMeter has dedicated commands which can do multiple tasks using the command prompt. Let us see how can we run a test in Non-GUI Mode and generate a nice HTML result.
How to run JMeter in Non-GUI Mode
We will start by creating a simple test in JMeter which will do a small load test on google.com search engine with minimal load. You can refer my step by step guide to create a simple load test JMeter Script. The final script will look as below. In thread group, you can set the number of virtual users which will put load on the server.
Before executing the load test, it’s always advised to check your script with one user. Once you are confirm that the script is working fine you can initiate the load test. I have just fine one thread group to check if the request is going to google.com. In listener, you can see the green ticked request which ensures that the request is being sent correctly.
Let us increase the virtual user in the thread group and run a small load test using JMeter in Non-GUI mode. For simplicity we will keep 20 virtual users with ramp up time of 5 minutes and loop count to be 1. The ramp up period is the amount of time it takes for all virtual users to come online and start sending requests. Our test plan is ready.
Running JMeter Test in Non-GUI Mode
To run JMeter in Non-GUI Mode, Open Command Prompt as an administrator in your windows.
- Go to the bin directory of Jmeter usind command cd jmeter_bin_folder_path
- Run the command jmeter -n -t jmeter_script_path -l jmeter_result_file_path . For example jmeter -n -t scripts\Load_Test_Google.jmx -l reports\report.jtl
- It will run the script and generate the result file in specified reports folder.
JMeter Non-GUI Test Summary
Once the test is completed you can run the below command to generate the dashboard from result file
jmeter -g path_to_result_file -o path_to_report_folder
Example – jmeter -g reports\report.jtl -o reports\result