https://github.com/laminko/lycan
A simple load testing script which uses YAML as taskset.
https://github.com/laminko/lycan
load-testing locust python python3 pyyaml yaml
Last synced: 4 months ago
JSON representation
A simple load testing script which uses YAML as taskset.
- Host: GitHub
- URL: https://github.com/laminko/lycan
- Owner: laminko
- License: mit
- Created: 2020-05-14T09:10:45.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-07-03T09:41:09.000Z (almost 2 years ago)
- Last Synced: 2025-10-13T15:33:21.525Z (8 months ago)
- Topics: load-testing, locust, python, python3, pyyaml, yaml
- Language: Python
- Homepage: https://github.com/laminko/lycan
- Size: 10.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [lycan](https://en.wikipedia.org/wiki/Lycan): loadtester script
A simple load testing script using [locust](https://locust.io/) and [pyyaml](https://pyyaml.org/). The story behind this is Ko [Setkyar](https://github.com/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.
```bash
cd /path/to/lycan
# NOTE:
# To create python 3.6 environment,
# $ conda create -n python=3.6
#
# To activate environment, if not yet.
# $ conda activate
# Then, install required dependencies
$ pip install -r requirements.txt
```
## Usage
First, create a `yaml` file inside `rules` directory.
Rule format is as follows:
```yaml
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:
```bash
$ 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.