Skip to content

Realistic e-commerce load testing with Locust using the public DummyJSON API.

License

Notifications You must be signed in to change notification settings

Fat3mi/locust-dummyjson-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Locust DummyJSON Load Testing

This project demonstrates real-world load testing using Locust and the public DummyJSON API.
It simulates e-commerce user behavior: browsing products, managing carts, and logging in.


Features

  • Product Browsing: list products, view details, search queries.
  • Cart Actions: view a user’s cart, add products to cart.
  • User Flows: fetch users, view profiles, perform login.
  • Data-Driven Randomness: randomized user IDs, product IDs, and queries for realism.
  • Custom Load Shape: simulate ramp-up, steady load, and ramp-down (peak hours).
  • CI/CD Ready: includes a GitHub Actions workflow that runs smoke tests automatically.

Start

1. Install Dependencies

pip install -r requirements.txt

Caution : strongly recommended to create & activate a virtual environment before installing dependencies.

2. Run Locust in Web Mode

locust -f locustfile.py

Then open 👉 http://localhost:8089 to control the test.

3. Run Headless Mode

locust -f locustfile.py --headless -u 50 -r 5 -t 2m
  • -u 50 → 50 concurrent users
  • -r 5 → spawn rate 5 users/sec
  • -t 2m → test duration: 2 minutes

Endpoints Covered

  • Products: /products, /products/:id, /products/search
  • Carts: /carts/user/:id, /carts/add
  • Users: /users, /users/:id, /auth/login

Continuous Integration

A GitHub Actions workflow runs smoke tests (5 users, 30s) on every push to ensure scripts always work.

🔗 Resources

About

Realistic e-commerce load testing with Locust using the public DummyJSON API.

Topics

Resources

License

Stars

Watchers

Forks

Languages