BreadcrumbHomeResourcesBlog How To Use The JMeterPluginsCMD Command Line February 18, 2019 How to Use the JMeterPluginsCMD Command LineOpen Source AutomationBy George MaksimenkoIn this blog post we are going to take a look at the JMeterPluginsCMD Command Line Tool. This command-line utility can generate PNG and CSV files based on JTL files. Thus, providing a convenient and quick way to extract the necessary data from JTL files in a presentable view, enabling easier analysis of Apache JMeter™ test results.This tool is very similar to the right-click context menu (Save Image as and Export to CSV options) on all graphs, and it’s a better choice when you need to process a lot of JTL files or to generate a lot of PNG and CSV files based on one JTL file; it saves time.Table of Contents:What is JMeterPluginsCMD?TheJMeterPluginsCMD CommandGenerating a JTLWhat is JMeterPluginsCMD?JMeterPluginsCMD is a Command Line Tool that lets you generate PNG and CSV files on graphs. It saves time when generating lots of files based on one JTL file.There are two ways to install the JMeterPluginsCMS Command Line tool. The first method is to simply install it through the JMeter Plugins Manager. The second method is to download the archive from the official page and manually add the files to the corresponding folders of your JMeter. Don’t forget to restart the application.After the installation, we should see the JMeterPluginsCMD.sh and JMeterPluginsCMD.bat files in the /bin directory of JMeter. Note: all commands below were run from the /bin folder on a MAC machine. So let’s learn more about this tool!TheJMeterPluginsCMD CommandFirst, create a JTL file in your regular JMeter script. Then, run the JMeterPluginsCMD command.Command template:sh JMeterPluginsCMD.sh --generate-png/csv --input-jtl --plugin-type --PARAMETER_NAMEThe command has 4 possible parameters:Generating a JTLLet’s create a basic script to generate a JTL file that we will use for demonstrating the JMeterPluginsCMD command line tool. I have chosen the BlazeDemo website (http://blazedemo.com/) to create our performance script.The BlazeDemo website is available to the public for testing and playing with performance scripts.1. Add a Thread Group to the Test planTest plan -> Add -> Thread (Users) -> jp@gc - Ultimate Thread Group2. Add a row with the following values:Start Threads Count: 20Initial Delay, sec: 0Startup Time, sec: 30Hold Load For, sec: 30Shutdown Time: 0This Ultimate Thread Group will start 20 virtual users within 30 seconds and will hold its target load for 30 seconds.3. Add an HTTP Request which opens the landing page of the test websiteUltimate Thread Group -> Add -> Sampler -> HTTP RequestFill in the following values:Name: LandingServer name or IP: www.blazedemo.com4. Add a Constant Timer to the Landing request.Landing -> Add -> Timer -> Constant TimerSet the following delay:Thread Delay (in milliseconds): 1000This timer will add a one-second delay before the Landing request.5. Add another HTTP Request that opens the vacation pageUltimate Thread Group -> Add -> Sampler -> HTTP RequestFill in the following values:Name: VacationServer name or IP: www.blazedemo.comPath: vacation.html6. Add a Constant Timer to the Vacation request as wellVacation -> Add -> Timer -> Constant TimerSet the following delay:Thread Delay (in milliseconds): 1000This timer will add a 1 second delay before the Vacation request.7. Add a View Results Tree listener to the Ultimate Thread Group.Ultimate Thread Group -> Add -> Listener -> View Results Tree8. Add a Response Times Over Time listener to the Ultimate Thread Group.Ultimate Thread Group -> Add -> Listener -> jp@gc - Response Times Over TimeSet the following name for log file:Filename: results.jtlThis listener will save the results of the load test to the results.jtl file.That’s it! Our basic script is ready and we can now execute it.9. Run the script.Our test passed. The test results were saved to the results.jtl file. The listener shows a graph of the response time in ms over time.Let’s look at what we would do without the tool;Open the context menu by right-clicking anywhere on the graph. Here we can see three options: Copy Image to Clipboard, Save Image as..., and Export to CSV. Let’s take a look at how the Save Image as... and Export to CSV options work.10. Save the report as an image to your computerRight-click on the graph -> Save image as ...The resulting image contains a Response time over time graph and the size of the image is equal to the size of the graph area in our JMeter.11. Save the report as a CSV fileRight-click on the graph -> Export to CSV…The resulting CSV file contains three columns: Elapsed Time, Landing, and Vacation.Now that we have learned how to generate an image and csv file by using the context menu let’s take a look at how to do this using the JMeterPluginsCMD command line tool.As mentioned above there are 2 types of files that can be generated using this plugin: PNG and CSV files. You can generate the by using the commands below.First, make sure you copy the results.jtl file to the /bin folder of JMeter.Then, open the command line and go to the /bin folder of JMeter.PNG generation:sh JMeterPluginsCMD.sh --generate-png blazemeter.png --input-jtl results.jtl --plugin-type ResponseTimesOverTimeResulting image:The final PNG image contains the corresponding graph. This image is similar to the image in paragraph 2.9 but with one difference: the size of the image is 800 x 600 px.CSV generation:sh JMeterPluginsCMD.sh --generate-csv blazemeter.csv --input-jtl results.jtl --plugin-type ResponseTimesOverTimeResulting file:The final CSV file contains the corresponding data from the test run.Bottom LineIn this blog, we have successfully explored the basic usage of the JMeterPluginsCMD tool.For more advanced reporting, upload your JMX file to BlazeMeter, and view your results in insightful and colorful graphs with many types of KPIs.START TESTING NOW
George Maksimenko Head of Business Development, Adexin George Maksimenko is a Lead QA engineer at Adexin. He has 10 years of experience in software testing. His primary activities in software testing are automation testing and performance testing.