browse by category or date

As I mentioned in previous post, I decided to pick Locust to help to do performance testing on my soon-to-be launched project.

First, we need to get Locust installed. If Python is not available in our system, we can download and get it installed. Since I’m on Windows, I downloaded Python 3.10.0 for Windows. Below is the command to install Locust:

pip install locust

To verify the installation:

locust -V
# locust 1.3.2

If above command produced errors, we need to add python’s script folder to PATH environment variable

C:\Users\__YOUR_WINDOWS_USERNAME__\AppData\Roaming\Python\Python310\Scripts

Before we can start writing the test script in Python, I recommend to install VS Code as editor for .py(python scripts). Having VS Code installed, let’s prepare the folder for all the test scripts, then launch VS Code:

mkdir projects
mkdir projects\python
mkdir projects\python\locust
cd projects\python\locust
code .

On VS Code it is highly recommended to install the python extension

Now let’s write our first test script (test.py):

from locust import HttpUser, between, task

class WebsiteUser(HttpUser):
    host = "https://sodeve.net"
    
    # wait in between requests, 5-15 seconds
    wait_time = between(5, 15)  
     
    @task
    def index(self):
        self.client.get("/") 
        
    @task
    def category(self):
        self.client.get("/posts-by-category/")

    @task
    def sitemap(self):
        self.client.get("/map/") 

Let’s run locust from VS Code console (press Ctrl+Shift+`):

locust -f test.py --logfile locust.log

If we never run a python program before, we will have below prompt:

Click “Allow”, then open this address http://localhost:8089 in your browser. You should see something like this:

Click “Start swarming” to start the test.

That’s all for my start on testing website using Locust. Next, let’s try to test an application which is using ADFS (Active Directory Federation Service) authentication. Cheers!

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Possibly relevant:

My current project is almost launched. One of the final steps is to do a performance/stress testing. The purpose of this test to measure:

  1. how fast the response under normal load
  2. maximum concurrent users before the response fell below the acceptance standard

As I am looking for a free/open source solution, I stumbled on this page. Here’s my short take on each of the software.

  1. JMeter. It is a Java-based application. But due to Java-licensing uncertainty, I was advised to totally skip this application
  2. Gatling. It’s a Scala-based testing application. Since I’m not familiar with Scala, I’ll keep this as last resort
  3. Locust. A python-based software. I have previously toying around with python, so this is a possible candidate
  4. Tsung. An erlang-based testing tool. Last release was 4 years ago, so maybe it’s no longer actively maintained. Also, I’m not familiar with erlang.
  5. Siege. Since this testing application is only running on Linux/Unix, I’m not considering it.
  6. Httperf. Another Linux-based application. Skipped
  7. Taurus. Not exactly a performance testing application, but more like an automation application. But its usage to automate JMeter or Selenium is prominently highlighted. It is a python application, so it might worth for consideration
  8. Artillery. A Node JS testing application. But reading from its page, this application purpose is more on testing the performance of the backend systems.
  9. Goad. A go-based application. Unfortunately, it’s totally dependent on AWS Lambda. So this is not suitable to my requirement

After looking at all of these options, and also considering things like budget, time required to learn, I decided to pick up Locust. So I’ll keep you posted on my progress on using Locust to test my project’s performance. Cheers!

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Possibly relevant:

To solve this issue, first ensure that you already have the nuget packages for SQLite are installed:

Add these lines in machine.config:

    <system.data>
        <DbProviderFactories>
			  <remove invariant="System.Data.SQLite.EF6" />
			  <remove invariant="System.Data.SQLite" />
			  <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
			  <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
    
		</DbProviderFactories>
    </system.data>

We can find machine.config in:

  1. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
  2. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config

That’s all friends. I hope it helps!

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

Possibly relevant: