Skip to content

laminko/lycan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lycan: loadtester script

A simple load testing script using locust and pyyaml. The story behind this is Ko Setkyar wants to test some APIs and not-so-complex and light weight solution. I found locust but tasks are defined in python. To overcome this, I create this python wrapper which generates HttpLocust and TaskSet classes from yaml file at runtime.

Installation

First, a python environment or python 3.6+ is required. To resolve this, I would like to recommend miniconda. To install miniconda, please refer to https://docs.conda.io/en/latest/miniconda.html.

Requirements

  • python 3.6+

Dependencies

Install required python libraries.

cd /path/to/lycan
# NOTE:
# To create python 3.6 environment,
# $ conda create -n <env-name> python=3.6
#
# To activate environment, if not yet.
# $ conda activate <env-name>

# Then, install required dependencies
$ pip install -r requirements.txt

Usage

First, create a yaml file inside rules directory.

Rule format is as follows:

name: TestThisHost
proto: http
host: localhost
port: 8000
tasks:
  - endpoint: /api/v1/users/
    method: POST
    # To define Headers
    headers:
      Content-Type: application/json
      ...
    data:
      name: kyawkyaw
      address: Yangon
  - endpoint: /api/v1/users/1
    method: GET
    headers:
      Content-Type: application/json
  - ...

Then, run following command:

$ locust -f loadtester.py

To start load testing, please open http://localhost:8089 in browser.

Ref: https://docs.locust.io/en/stable/quickstart.html#open-up-locust-s-web-interface.

About

A simple load testing script which uses YAML as taskset.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages