How to do JMeter Load Testing Tutorial
Apache JMeter can simulate heavy loads on a server by creating multiple virtual users, also known as concurrent users, simultaneously. JMeter can also be used to test both web and FTP applications, SOAP and REST APIs, as well as email protocols like SMTP, POP3, IMAP and much more.
On-demand. No credit card. No contract.
1 – Verify System Requirements
Before using JMeter, you must ensure that a current version of Java is installed on your system. The latest version requires Java 8 or higher. It is best practice to always use the most current version of JMeter as the software is constantly being improved and updated.
1-1 Download & Install JMeter
- Visit the Apache JMeter website.
- Select Download Releases from the left-hand side of the page, under Download.
- Select from JMeter Binaries or JMeter Source files and it will begin downloading.
- Unzip and extract the file into the location/folder on your machine once the file is downloaded.
Note: JMeter can be started in three different modes. For the purposes of this JMeter load testing tutorial, we will focus on starting in GUI mode.
- GUI mode. GUI mode is used to build test scripts and debugging.
- Command Line Interface (CLI) Mode. CLI mode is used for load testing.
- Server Mode. Server mode is used for distributed load testing on remote nodes.
1-2 Launch JMeter
- Navigate to the location where you saved the JMeter directory.
- Select the /bin folder
- Locate and select the jmeter.bat file
- Wait for the interface to begin loading (GUI mode). Once it has finished loading, we can begin creating our test plan.
No credit card. No contract.
2 – Create JMeter Test Plan
Once JMeter has completely loaded, you can begin the process of creating the test plan. The test plan includes all of the elements that go into building the test plan. We will talk more about these elements in the coming sections.
2-1 Set Up JMeter Test Plan
- Select File from the top-left corner to create a test plan from scratch.
- Select New.
- Select the New icon from the toolbar (alternative method). A new test plan will be displayed on the screen.
- Configure the test plan elements.
JMeter also allows users to build test plans from templates that contain the necessary test elements. There are numerous options available depending on your JMeter load testing requirements. Listed below are just a few of the options that are available to users.
- BeanShell Sampler
- Building a SOAP WebService Test Plan
- Building an Advanced Web Test Plan
- Building an FTP Test Plan
- Functional Testing Plan
- Building Webservice Test Plan
2-2 Create a Thread Group (Users)
- Right-click on Test Plan from the Test Plan Tree View window.
- Select Add.
- Hover over the Threads (Users) option. Another window will appear to the right.
- Select Thread Group. The Thread Group properties will appear in the Editor window.
- Configure Thread Properties: Number of Threads (Users), Ramp-Up Period, and Loop Count.
- Add a Thread Group Name and specific test plan notes in the Comments field, if necessary.
On-demand. No credit card. No contract.
3 – Configure Samplers
Samplers are the actual requests to the server. For example, HTTP samplers are used for a website, application, or API load test. Other Samplers include FTP, SMTP, Java, JDBC, and SOAP requests. To create a request Sampler, follow the steps below. For the purposes of this JMeter load testing tutorial, we will add an HTTP sampler.
3-1 Adding a Sampler
- Right-click on Thread Group under your Test Plan window
- Hover your cursor over Add. A window will open to the right of the Add selection.
- Hover your cursor over Sampler. A drop-down menu will appear will all the Sampler options.
- Select the HTTP Request Sampler. The Editor window will be displayed.
From here, you can configure and customize your HTTP Sampler.
- Add a name for your HTTP Request sampler in the Name field. Optionally, you can add comment for this specific to this Sampler in the Comments field.
- Add the specific protocol (HTTP or HTTPS).
- Enter the Server Name or IP address. If necessary, you can also enter the Port Number.
- The default request type is set to GET, but you can also change the request type (POST, HEAD, PUT, PATCH, etc., if necessary.)
- Lastly, if you are testing a specific URL path, add that path in the Path field.
There are also additional configuration options listed under the Advanced tab. Once you have configured the Sampler, you can select Save.
3-2 Add Listeners
- Right-click Thread Group.
- Place your cursor over Add. Hover your cursor over Add. A window will open to the right of the Add selection.
- Select Listener. Here you will see a list of Listeners. Listeners are what allows you to review the test results and reports. For the purposes of this tutorial, we will use the View Results Tree Listener.
- Select View Results Tree Listener. Note: Multiple Listeners can be added to a load test.
4 – Run Load Test and Analyze Results
4-1 Run JMeter Test
- Save your test plan by selecting File > Save from the top-left corner.
- Select Start from the Run menu.
- Click the green arrow Run icon from the toolbar. This is an alternative method to begin the test.
- Wait for the test to run and finish.
- View Results.
You will see the test results appear below in the Test Plan window, along with various metrics.
- The Sample # represent the number of runs, or users.
- Start Time for each Thread.
- Thread Name for each run and user.
- Sample Time is the time taken for each request.
- Status. Green checkmark indicates it has passed. A red checkmark indicates a failure.
- Additional metrics, such as Bytes, Sent Bytes, and Latency are also included.
Running Large-scale Load Tests with LoadView
As an open-source load testing tool, JMeter allows performance testers and engineers to carry out fairly basic, straightforward test scenarios. However, it has its limitations. If you are looking to generate large-scale tests, in real browsers, from multiple geo-locations, you need a more modern load testing solution that can handle these real-world scenarios. LoadView is a cloud-based performance testing solution that provides developers the functionality to test websites, APIs and web services, web applications, Postman Collections, and JMeter scripts – all from single interface. No more worrying about hardware upgrades or managing load generators. LoadView removes these time-consuming, burdensome, and costly tasks so developers and engineers can focus on testing.
All from one convenient load testing solution: LoadView