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.
Table of Contents
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.
- Go to the command prompt.
- Type the command “java -version” and press enter.
- You will see the what Java version is installed if it was installed otherwise it will show the message “The command was not recognized”.
After installing and verifying the Java installed on your computer, you can use the following steps in order to download and install the JMeter.
- At first, go to the JMeter page (https://jmeter.apache.org/) on the Apache website.
- Now, click on the “Download Releases” link from the sidebar.
- 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.
- After downloading finished unzip and keep JMeter folder at any location.
- Now, open JMeter folder and then bin folder.
- Search for “jmeter.bat” and double click on it or directly open the “ApacheJMeter.jar” file.
Create and Run First JMeter Test
After successfully loading the
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.
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.
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
- Right click on recently created Thread Group name and click on Add.
- Select the Sampler and then click on HTTP Request.
- Change the default name of HTTP Request with editing it.
- Now, configure the web server and HTTP Request from Basic tab and timeouts and proxy server from Advanced tab.
- Write the server name, protocol (http or https) and port number (if required) under web server settings.
- 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/”.
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.
- Right click on Thread Group name.
- Go to Add and then Listner.
- 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.
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.