Performance Testing with JMeter, Locust and Gatling

Ozgur Kaya
Software Testing Bootcamp
5 min readNov 8, 2021

Youtube Webinar Video:

Getting Started:

This document will help you to review popular open-source performance testing tools such as Jmeter, Locust and Gatling.

We will make live examples on many subjects such as installation and technology, recording scenarios, running tests, test tracking and reporting, logging, resource consumption. Together we will be looking for answers to the questions of which one should we use and when, which one is more suitable for us.

JMETER

Jmeter Requirements:

  • Java JRE or JDK Installation (Requires Java 8+)

https://www.oracle.com/tr/java/technologies/javase-downloads.html

  • Download the latest release of JMeter (Binaries -> zip extension) and unzip the file.

https://jmeter.apache.org/

  • Download plugins-manager.jar and put it into JMeter’s lib/ext directory, then restart JMeter.

How to run the Jmeter test with GUI support?

  1. Start bin/jmeter.sh on MacOS or bin/jmeter.bat file Windows OS.
  2. Open Jmeter/demoblaze.jmx file from Jmeter GUI
  3. Use Thread Group to set your virtual user load and test time.
  4. Start your test and view Test Results on listeners (View Results Tree, Aggregate Graph, …)

How to run Jmeter test from Terminal or Command Prompt?

  1. Start Terminal or Command Prompt
  2. Start Jmeter Load Test from Command-line with full paths for jmeter.sh , JMX file and the JTL file for the results. sh /Users/ozgur.kaya/Downloads/apache-jmeter-5.4.1/bin/jmeter -n -t /Users/ozgur.kaya/Downloads/demoblaze.jmx -l /Users/ozgur.kaya/Downloads/jmeterTestResults.jtl

NOTE: If you got some Copy-Paste issues on JMeter please change your Jmeter theme by clicking Options -> Look and Feel -> System

LOCUST

Locust Requirements:

  • Install Python 3.6 or later

https://docs.python-guide.org/starting/installation/

  • Install locust from terminal

pip3 install locust

  • Optionally you need an IDE for the development. We will use Visual Studio Code in this example. Do not forget to install the Python plugin for the VS Code.

How to run the Locust test without a configuration file?

  1. Open the terminal and navigate to your downloaded Locust/no-config/locustfile.py file. cd /Users/ozgur.kaya/Downloads/Locust/no-config
  2. Type “locust” and press ENTER.

3. Open your browser and type this URL to visit “http://0.0.0.0:8089/". Set number of users to 100, set spawn rate to 100 and set the host as “https://www.demoblaze.com/"

4. You can view the test while it’s running.

How to run Locust test with configuration file?

  1. Open the terminal and navigate to your downloaded Locust/with-config/DemoBlaze.py file. cd /Users/ozgur.kaya/Downloads/Locust/with-config
  2. Type “locust” and press ENTER. The test will start at that moment. No need to trigger from UI.
  3. Open your browser and type this URL to visit “http://0.0.0.0:8089/".
  4. You can view the test while it’s running.
  5. You can change the test settings from this downloaded file Locust/with-config/locust.conf

GATLING

Gatling Requirements:

  • Install Java JDK

https://www.oracle.com/tr/java/technologies/javase-downloads.html

  • Install Brew as described in that URL -> https://brew.sh/
  • Install Scala with this command from Terminal brew install scala
  • Download Gatling Open-source from this URL. And extract the zipped file on our computer. (“gatling-charts-highcharts-bundle-x.x.x-bundle.zip”) https://gatling.io/open-source/
  • Optionally you need an IDE for the development. We will use IntelliJ IDEA in this example. Do not forget to install the Scala plugin for IntelliJ.

https://www.jetbrains.com/idea/download/

How to run the Gatling test from Terminal?

  1. Copy Gatling/user-files into your gatling-charts-highcharts-bundle-x.x.x-bundle unzipped folder and overwrite them.
  2. Open the terminal window and navigate to your user-files directory. cd /Users/ozgur.kaya/Downloads/gatling-charts-highcharts-bundle-3.6.1/user-files
  3. Run the gatling command. sh /Users/ozgur.kaya/Downloads/gatling-charts-highcharts-bundle-3.6.1/bin/gatling.sh
  4. Choose DemoBlaze as your simulation number. In this example, we will type “0” for this.
  5. Press ENTER for the run description.
  6. You can watch your test on the command line while running.
  7. After the test has been finished You can open index.html file to inspect test results with graphs. Example Path: /Users/ozgur.kaya/Downloads/gatling-charts-highcharts-bundle-3.6.1/results/demoblaze-20211104165049624

--

--