Load Testing with Locust

You might be familiar with load testing tools such as Apache Benchmark (ab), siege, Apache JMeter and cloud services such as BlazeMeter, LoadImpact, Loader.io, etc. I tried many other tools, and found that there is no tool that completely satisfies me: ab and siege are too plain and simple without scenario, JMeter needs time for recording and defining cases (and I personally don’t like its UI, years ago. I have not tried it yet recent years), cloud load testing tools are … expensive, while I am poor 🙂 So today I blog a new entry: load testing with Locust. Hope that Locust does not disappoint me.

I mostly use Ubuntu 16.04 for master and slave nodes.

Install Locust

  1. Install pip:
  2. Install locust:

Write a simple test scenario with Python

  1. First, I will install faker lib so that I can easily generate test data later:
  2. Next, I will write a sample-test.py file as follows (First I will log in, and then visit a blog or add a new blog entry. I will also wait from 5s – 9s between 2 testing actions/tasks):

  3. Next, I’ll run it with locust with no web for 1 min:
  4. After checking everything, I write the full test case and then run real testing with a web interface and higher load.

Leave a Reply