CS/IT Tutorials Collections

How to get started with JMeter – Step by Step Guide

Pinterest LinkedIn Tumblr
JMeter is an open source software testing tool developed by Apache Organization. This tool was mainly used for load, performance and stress testing along with several applications and uses. It was a desktop application developed with Java.

Since JMeter was developed with Java, it can run in any kind of machine having Java virtual machine installed. It can simulate different types of requests on any kind of databases, FTP, HTTP, HTTPS, and other servers.

How to get started with JMeter

Here is a step by step guide for downloading and installing JMeter on windows environment to get started with JMeter along with the methods of writing the first JMeter test.

Download and Install JMeter on Windows

In order to get started with JMeter, you have to download and install JMeter at first. Before installing Jmeter on your computer, you must have to install the Java Runtime Environment (JRE) or Java Development Kit (JDK). Use the following steps to check whether the Java is installed and to find out what the version of Java installed.

  1. Go to the command prompt.
  2. Type the command “java -version” and press enter.
  3. You will see the what Java version is installed if it was installed otherwise it will show the message “The command was not recognized”.
Verifying Java installed with command prompt

After installing and verifying the Java installed on your computer, you can use the following steps in order to download and install the JMeter.

  1. At first, go to the JMeter page (https://jmeter.apache.org/) on the Apache website.
  2. Now, click on the “Download Releases” link from the sidebar.
  3. Find the latest release of the Apache JMeter and download the file on binaries format. Click on the links “apache-jmeter-x.x.x.zip” or “apache-jmeter-x.x.x.tgz” to start the download.
  4. After downloading finished unzip and keep JMeter folder at any location.
  5. Now, open JMeter folder and then bin folder.
  6. Search for “jmeter.bat” and double click on it or directly open the “ApacheJMeter.jar” file.
Apache JMeter Window

Create and Run First JMeter Test

After successfully loading the JMeter application, you will be ready to create the JMeter Test. Use the following steps for creating your first JMeter Test.

Step1: Create a Test Plan

In order to perform the JMeter test, you have to create a test plan at first. For this, go to the file menu and click on New. You may directly click on New button from the toolbar or use keyboard shortcut key “Ctrl+L”. You can change the name of the test plan with editing the default name.

Creating a Test Plan

Step2: Create a ThreadGroup

After creating a test plan, you will now create a ThreadGroup. It is the combination of different test plan elements, here we specify the number of threads, ramp-up periods and loop count. The number of threads is a number of users that are used while executing the test plan. Ramp-up period is the time required to JMeter to start all the threads and loop count is the numbers of time the test plan will execute.

To create the ThreadGroup, right click on Test Plan, click on Add and click on Thread Group located under Threads. You can rename the Thread Group with editing the default name.

Set the Number of Threads, Pamp-up period and loop count. In the example below, we have set Number of Threads=5, Ramp-up period=1, and Loop count=5.

Creating ThreadGroup

You may also enable and setup for the scheduler if required. Where you can set the duration in seconds, start up in seconds, start time and end time.

Step3: Add a Sampler

Now, you will add the test URL using a sampler. We will use samplers to send requests to different kinds of servers. Samplers execute requests based on the configurations that we will provide. There are numbers of samplers available with the JMeter, which are as follows.

  • Access Log Sampler
  • AJP sampler
  • Bean shell Sampler
  • BSF Sampler
  • Debug Sampler
  • FTP Request
  • HTTP Request
  • Java Request
  • JDBC Request
  • Different JMS Samplers
  • JUnit Request
  • Different LDAP Samplers
  • Mail Reader Sampler
  • OS Process Sampler
  • SMTP Sampler
  • Flow Control Action
  • TCP Sampler
  • Test Action

Among the list above, we will discuss in this tutorial only about the HTTP Request. Use the following steps to add the HTTP Request as a sampler.

  1. Right click on recently created Thread Group name and click on Add.
  2. Select the Sampler and then click on HTTP Request.
  3. Change the default name of HTTP Request with editing it.
  4. Now, configure the web server and HTTP Request from Basic tab and timeouts and proxy server from Advanced tab.
  5. Write the server name, protocol (http or https) and port number (if required) under web server settings.
  6. Configure the the HTTP Request with selecting HTTP request method and path of the testing URL from the root domain.

On the screenshot below, we have added “siteforinfotech.com” on the server name, set the protocol “https” and set the path “software-testing-tutorials/”.

Adding samplers in Apache JMeter

Step4: Add Listners

Listners are the different ways of getting reports for the results produced by samplers. They provide the test reports in different formats tables, trees or plain log files.

In this tutorial, we will discuss on how to view the results in table and tree. For this, you have to add them to the Thread Group. You will do that using the following steps.

  1. Right click on Thread Group name.
  2. Go to Add and then Listner.
  3. Click on View Results in Table or View Results Tree.

Step5: Run the Test

After performing all the steps described above, you will be ready to run the test. You can run the test with clicking on start under the Run menu, pressing “Ctrl+R” from the keyboard or clicking on the run button (triangular green button) from the toolbar. When the test is running, you will see a green button along with the information of test execution beside the button.

Step6: View the Reports

You can view the reports generated by JMeter when your test plan executed successfully. To view the results in the table, click on “View Results in Table” located under Thread Group. Screenshot given below shows the test results in Table.

Apache JMeter View Results in Table

To view the results in the tree, click on “View Results Tree” located under Thread Group. Screenshot given below shows the test results in Tree.

Apache JMeter View Results Tree

Please follow and like us:
RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
linkedIn | How to get started with JMeter - Step by Step Guide
Share

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Write A Comment

RSS
Follow by Email
X (Twitter)
Visit Us
Follow Me
YouTube
YouTube
LinkedIn
Share