Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/locust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Locust Performance Test

on:
workflow_dispatch:
push:
branches:
- main
- master

jobs:
locust-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run Locust tests
run: |
locust -f tests/activities_get_test.py --headless -u 10 -r 2 --run-time 1m --csv locust_result --logfile locust.log

- name: Upload Locust log
uses: actions/upload-artifact@v4
with:
name: locust-log
path: locust.log

- name: Upload Locust CSV results
uses: actions/upload-artifact@v4
with:
name: locust-csv
path: locust_result*.csv
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,23 @@ This project uses Locust to perform load testing on web applications. Locust is

#### Create a virtual environment
```bash
python3 -m venv <environment_name>
```
### Cloning the repository
git clone https://github.com/AlexAlexandreAlves/locust-performance-test.git

#### Activate the virtual environment
```bash
source <environment_name>/bin/activate
```
### Run through the venv (virtual environment), for this, you need to create and activate it first
python3 -m venv {$name}
source {$name}/bin/activate

#### Install dependencies
```bash
### Copy all folders and files in the main project and past into your recent created env-folder, and then install the dependencies:
cd {your-venv-folder}
pip install -r requirements.txt
```

## Executing Locust Tests

#### Execute Locust with web interface
```bash
locust -f <locustfile.py>
locust -f activities_get_test.py
```

#### Execute a specific test in headless mode
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.