x

How to Perform Load Testing with JMeter:

Step by Step Instructions for Beginners


blog28


Using an open-source performance testing tool like JMeter, organizations can run performance tests on their web applications, websites, and APIs without needing to invest any money upfront as they would with a commercially-based tool. Many factors should be considered before choosing an open-source desktop-based load testing solution like JMeter over a paid web-based solution, such as LoadView.

When you are just getting started with JMeter, it may help to read appropriate articles or watch videos to understand how it all works. Let us look at some of the steps involved in installing JMeter and configuring a basic load test.

Step 1: Verify System Requirements
In order to be able to run JMeter, you need to make sure that your system meets the necessary requirements. We mentioned earlier in this guide that JMeter is a Java-based application, so make sure you have Java installed and the correct version.

Versions of Java 8 or higher are compatible with JMeter. Moreover, it is recommended that you install the latest minor version of JMeter for improved performance and security. Several operating systems can run JMeter on Windows, Mac, and Linux, so verify that your OS is compatible or that you have a Java implementation that is compliant.

Step 2: Download JMeter Binaries or Source Code
Depending on your environment or requirements, you can download the latest JMeter binaries or source files once you have verified that your system meets all of the necessary requirements. You can run the compiled versions of JMeter immediately after downloading the binary files.

Source files, on the other hand, can be installed without using a package manager, allowing developers or teams to compile the program themselves and to have more control over the programs installed. Software is normally installed in binary form. Note that different file types can be downloaded, including .zip and .tgz.

Step 3: JMeter Installation Process
JMeter will be downloaded to your system once you have chosen a binary or source version. The file can be opened, moved to a new location, or created as a new folder to make it easier to find later. Once this is done, it can be extracted. This can take a few minutes to complete the entire installation process.

During the installation process, you may encounter different steps depending on your operating system, but once JMeter has been installed, it will operate the same way.

Step 4: JMeter User Interface
Upon starting JMeter, the Test Plan window will open and be displayed. In this window, you can build your test plan. Near the top left-hand corner of the window, you will find the Menu and Main ToolBar. Both the Menu and Main ToolBar contain some of the same features, but the Main ToolBar provides quicker access to some of the tools and functionality you will be using during the load test creation and configuration process. When running the test, the top right-hand corner of the window has options for time, logs (view/hide), and users.

It is in the Editor section that you will be able to see and configure the Test Plan elements and fields for your load test. You will see the Test Plan tree view to the left of the Editor section as you go through the test creation and configuration process and can expand and close individual elements to drill down into them individually.

Step 5: Create a Load Test Plan
JMeter users can create their load test plans from scratch or select from various test plan templates available in the File drop-down menu. Templates include SOAP WebService Test Plans, basic and advanced Web Test Plans, FTP (File Transfer Protocol) Test Plans, and Functional Testing Plans. These test templates will include all the necessary specific elements, sections, and fields that you will use to create and build your load test plan. If you are new to performance testing or JMeter itself, you may initially prefer to utilize templates instead of building your test plan from scratch, before moving on to more advanced test plans.

Simply navigate to File and choose New or click the New button in the Toolbar to begin creating a Test Plan. It is crucial to note that to create the Test Plan, JMeter must be run in GUI mode. During the load test, the CLI, or command line interface, is used. In the next section, we will discuss specifying the number of users for your load test, which is also called the Thread Group.

Step 6: Create Thread Group
You can set and adjust a number of Thread Properties within the Thread Group dialog box, such as the Number of Threads (Users), Ramp-up period (in seconds), and Loop Count (how many test iterations), as well as additional actions, such as delays, test start and stop times, and the actions to take after a Sampler error.

Step 7: Configure Sampler
Samplers in JMeter are what JMeter uses to send the different types of requests. HTTP requests (for a website, application, or API), FTP requests, SMTP requests, and TCP requests are examples of HTTP requests. For example, if you want to run a load test against a web page or website, you will select an HTTP request. From here you are displayed with entering additional details such as the Protocol (HTTP/S), Server Name or IP, Path (for specific web page), and what type of request, such as GET, POST, HEAD, PUT, etc., which can be used for API load testing.

Step 8: Configure Listeners
Next, you need to configure what JMeter calls Listeners in order to be able to review the Sampler results. To view and analyze results, you can choose from a variety of Listeners in the JMeter Test Plan window, such as Summary Report, Aggregate Graph, View Results Tree, and View Results in Table. In addition, you can add multiple Listeners to a JMeter test plan. You can now run the test according to your Test Plan.

Step 9: Recording the Load Test Scripts
When it comes to test configuration, if you're just looking to run basic HTTP, or protocol-level, load tests, then there's nothing more you have to do. The HTTP(S) Test Script Recorder must be used if you need to configure a test that more closely mimics user actions. So, within JMeter, this adds another step in the Test Plan. Within the Thread Group, you will need to add the Recording Controller.

The Recording Controller allows you to navigate through a site or application, and it will record your actions via HTTP/S requests. You can also add multiple Recording Controllers per page. The Recording Controller saves time, so you do not have to manually add each request. The EveryStep Web Recorder, the recording component of LoadView, provides significant advantages over JMeter's point-and-click scripting in real browsers without the complexity and time-consuming setup required by JMeter. You can begin scripting as soon as you open the recorder.

Step 10: Execute the Load Test
After you have configured all your load test details and settings, you can simply select the Run button in the ToolBar and your test will begin. Remember to run the test in CLI mode to get better results.

Step 11: Review the Load Test Results
As the test runs, you can view the results based on the type of Listener you selected. You would see the results displayed as each user or run is executed, for example, if you selected View Results in Table. There will also be additional metrics in the results, such as Time (in milliseconds), Status (showing valid responses and errors), Bytes and Bytes Sent, Latency, and Connect Time. You can see if any errors occurred or if the page loads slowly from these results.

Go To Top