If you are new to JMeter, you have come to the right place. In this post, we will walk you step-by-step through creating your first, functional JMeter test plan from scratch. We will guide you through how to install JMeter on your local device and navigate the user interface of the test plan editor. Starting from a blank canvas, we will create a basic test plan. From there, we will use RedLine13 to run your test in the cloud, touching on concepts of performance and scalability.
A Brief Introduction to JMeter
Of the multitude of modern load testing frameworks, JMeter is perhaps the most popular and arguably the most well-established tool in this space. JMeter works by generating requests (e.g., web requests over HTTPS) to a target test application. These requests simulate traffic that would be generated by systems and users accessing these applications. When these requests are scaled up, they can probe the performance of applications systems under heavy or dynamic loads.
Downloading and Installing JMeter
The latest version of JMeter can be downloaded here. In order to run JMeter on your local machine, you will also need to install Java. Installation is straightforward with the most common configuration options set up by default.
Starting JMeter for the First Time
There are two modes of use for JMeter. The GUI is the mode of interest for first-time use as it will allow you to create your test plan visually. If you have installed JMeter on Windows, you can start JMeter by running “jmeter.bat
”. On other Linux and Unix based platforms, the “jmeter
” command can be invoked to start the JMeter GUI.
The other mode for JMeter is non-GUI mode, which is used to run core load testing features without the performance penalties of running the full user interface. We will discuss more about running JMeter in this mode later.
Creating your First Test Plan
Opening JMeter for the first time reveals a sort of a blank canvas. There is an empty “Test Plan” tree on the left, and a configuration panel on the right. All of our test plan components will reside under the root element in this tree:
Components are added to test plans in a nested tree-like structure. The “Thread Group” is the basic container for actionable elements. You can add a Thread Group to the test plan by right-clicking on the root test plan element:
Like nearly all test plan components, the Thread Group has several properties that can be specified in its configuration panel:
For our purposes, we can leave the default options configured. This will execute our test plan exactly once (as defined by “Loop Count”) and with a single virtual user. In another article, we discuss how to set the number of virtual users for more advanced cases.
The next step is to add elements such as HTTP requests to our Thread Group. These represent the functional elements of a test plan. Here we have added three HTTP requests:
For more complicated tests, JMeter features a multitude of built-in components as well as officially supported plugins. These are designed to both extend the functionality of JMeter, as well as automate common tasks. In another article we reviewed the top 10 JMeter plugins in order of most frequently used.
Running your Test Plan
Now that we have a basic test plan, we are ready to run it and check that it functions as intended. First tests are best run within the GUI so that we can monitor the output of our requests. In order to see this we will need to add a “View Results Tree” listener element to our test plan:
Running the test from within the GUI will allow us to see results in real time. Output is organized by test plan element as shown:
While we are running our test plan, the purpose at this stage is not to generate load. Rather we are performing the important task of validating our test plan to ensure that it executes according to our design.
Real-World Test Plan Runs
Earlier in this article we described how JMeter could be started in GUI or non-GUI mode. Up to this point we have only discussed GUI mode. Since loading all the user interface components can cause significant system overhead, when it comes to accurate data collection it is preferable to run JMeter without the GUI. This necessitates running JMeter from the command line, using the “-n
” option to specify non-GUI mode. The “-t
” option should also be specified to indicate the location of your test plan. Therefore the command line should be similar to as follows:
jmeter -n -t my_test.jmx
Your test plan will run immediately, with data collection recorded to disk in the form of log files, and a locally stored JTL results file.
Moving Your Test to the Cloud
One limitation to scaling a JMeter test is the local environment. At a certain level of scale, a given machine will have hardware performance constraints, as well as network performance constraints. Using a cloud-based testing provider such as RedLine13 can overcome these constraints by distributing your test across multiple load generator servers.
Instead of running requests locally from your network, your test plan is sent to virtual machines in the cloud which run multiple instances of your test simultaneously and in parallel:
At the conclusion of your test, all results are collected and aggregated and displayed in a manner similar to as if you ran a single, large test. Using an architecture such as this it is possible to achieve nearly unlimited scale.
Did you know that RedLine13 offers a full-featured, time-limited free trial? Sign up now, and start your performance testing in the cloud today!