Did you hear about the most widely used security and performance testing tool? Wondering what it is? It is JMeter. JMeter is a leading open-source performance testing tool. Due to its flexibility, JMeter is accepted by many organizations across the world. To analyze the performance very quickly, we can even integrate JMeter with various APIs like SOAP/REST, selenium, etc. So Choosing JMeter for your Organization will help you to track the performance. JMeter Training can help you in using JMeter efficiently. So, in this post, let us learn about installing JMeter and building test plans in JMeter.

What is Jmeter?

JMeter is open-source software that can be used to measure the performance of services and to load the functional behavior of the test. It is a pure java application that was designed to test web applications or FTP applications and then expanded to other test functions. Performance testing indicates testing the web application for heavy load, concurrent, and multiple user traffic. JMeter will stimulate a group of users who send requests to the target server, then return the statistics, which shows the functionality or performance of the application or target server through graphs, tables, etc.

JMeter can run on any of these operating systems that accept Java virtual machines: Windows, Linux, Mac, etc. Let us complete the installation of JMeter in four easy steps.

JMeter Installation:

Step 1: Installing Java

As JMeter is a java based application, JMeter requires Java Virtual Machine. Download the JDK with the latest version and install. To check whether the installation of JDK is done correctly or not, in Linux or Windows, go to the terminal and enter the command ‘java -version’. If it is not installed correctly, then reinstall it.

Step 2: Downloading JMeter

JMeter’s latest version is Apache JMeter 5.4.1. It can be downloaded from the below link:

http://jmeter.apache.org/download_jmeter.cgi

Click on the above link to download JMeter, choose binaries, then click either tgp or zip format.

Step 3: Installing JMeter

Unzip the tar or zip file you have downloaded in the folder where you wanted to install JMeter. After unzipping it, the root directory is apache-jmeter-5.4.1, and inside this directory/folder, you find these folders. 

  • /bin 
  • /docs
  • /extras
  • /lib
  • /printable_docs

The bin folder contains all the script files that are required for starting JMeter. The folder docs contain documentation files related to JMeter, and the lib folder contains the Java library required for JMeter. In the lib folder, there are two other folders named lib/ext and lib/junit. The lib/ext folder contains the jar files and the protocols of JMeter, while the lib/junit folder contains the Junit library.

Step 4: Launching JMeter

JMeter can be started in three modes: GUI, Command Line, and Server Mode.

  • Starting JMeter in GUI Mode: In your windows system, for starting JMeter in GUI Mode, run the file /bin/jmeter.bat.
  • Starting JMeter in Server Mode: Generally, for distributed testing, Server Mode is used. It will work as client-server mode. JMeter will run in GUI mode on the client system. But on the server system, JMeter will run in server mode. For starting JMeter in server Mode, ‘bin/jmeter-server.bat’ must be runned.
  • Starting JMeter in Command line Mode: Generally, the command line mode option is best. It saves the computer memory. Starting JMeter in GUI mode will consume more computer memory. So to save the resource, we can run JMeter in the Command line mode option. In the JMeter command line, include JMeter -n, then write the file name containing the test plan, then include a folder to store log file results and finally write the name of the Proxy server host and the port number.

What is a test plan?

A test plan is described as a series of steps that are executed by JMeter when run. A perfect test plan contains sample generating controllers, logic controllers, one or more thread groups, timers, listeners, configuration, and assertion elements.

Now let us know how to build a JMeter Test Plan.

Test Plan

Building a JMeter Test Plan:

  • Adding, Loading, and Removing elements: 

To add elements to the test plan right click on the element in the tree and select ‘new’ element from add list. Elements also can be added and loaded from the file by selecting the ‘open’ or ‘merge’ option. To remove an element, select it, right-click on it and select the ‘remove’ option.

  • Saving elements:

To save the tree element, you need to right-click on the element and select the ‘save selection as’ option.

  • Configuring tree elements: 

Controls of any element in the test plan are displayed in the JMeter right-side frame. They enable us to configure the behavior of the test elements. Configuration of the elements depends on the type of element.

  • Saving the test Plan: 

Before running a test plan, you need to save it. From the file menu, select ‘Save’ or ‘Save Test Plan as’ to save the test file.

  • Running a test plan: 

Select the ‘start’ option from the ‘run’ menu for running your test plan. Under the menu bar, at the right-hand end of the section, a small green box is displayed when JMeter is running. There is another way to check whether your test plan is running or not. In the ‘run’ menu, ‘stop’ is enabled, and ‘start’ is disabled; it indicates your test plan is running.

  • Stopping a test: 

For this action, there are two commands in JMeter. They are ‘StopTestNow’ and ‘shutdown[.cmd| .sh]. The ‘Stop’ command will stop the threads immediately. If it fails, then a message is displayed, then you can retry the command or exit JMeter. The ‘Shutdown’ command will request the thread to stop after the completion of the current task. It will not disturb the active tasks. The shutdown dialog box will be active till all the current threads stop.  

  • Error reporting: 

Warnings and errors are reported to the jmeter.log file by JMeter. We can also find some information about the errors or warnings on the test run itself. 

Conclusion:

JMeter is one of the best performance analysis tools used in many organizations. So to gain some knowledge on using JMeter, we have learned how to install JMeter and how to build the test plans in JMeter.

JMeter Installation & Test Plans