Load Testing Hub
Load Testing Hub is a Python library and CLI tool designed to upload performance testing results into the load-testing-hub-api. It provides a convenient connector for reading and transforming Locust reports and sending them to the Load Testing Hub API over HTTP.
Key Features
- Easy integration with Locust reports (CSV/JSON).
- Raw Python API for programmatic usage.
- CLI support for quick uploads from configuration files (YAML or JSON).
- Pydantic-powered configuration for strict validation and clear error messages.
Installation
pip install load-testing-hub
For development:
git clone https://github.com/Nikita-Filonov/load-testing-hub.git
cd load-testing-hub
pip install -e .
Usage
1. Python API
You can upload Locust results directly from your Python code by using the raw API:
import asyncio
from pathlib import Path
from load_testing_hub import (
Service,
Scenario,
Pipeline,
upload_locust_report,
UploadLocustReportParams
)
# Main async function to upload Locust test results
async def main():
await upload_locust_report(
UploadLocustReportParams(
# Base URL of the Load Testing Hub API
api_url="http://localhost:8000",
# Information about the service for which results are uploaded
service=Service(id=1),
# Scenario metadata (name, configuration file, version, and load parameters)
scenario=Scenario(
id=1,
name="get accounts", # Scenario name
file="./scenarios/get_accounts/v1.0.conf", # Path to scenario config file
version="v1.0", # Scenario version
number_of_users=500, # Number of virtual users in the test
runtime_duration="3m" # Test duration (3 minutes)
),
# CI/CD pipeline that triggered the load test execution
trigger_pipeline=Pipeline(
ci_job_url="http://localhost:8001/pipeline/1/job/3", # URL of the triggering job
ci_pipeline_url="http://localhost:8001/pipeline/1", # URL of the triggering pipeline
ci_project_version="v1.11.0" # Project version under test
),
# CI/CD pipeline where the load test scenarios are located
load_tests_pipeline=Pipeline(
ci_job_url="http://localhost:8001/pipeline/3/job/9", # URL of the load tests job
ci_pipeline_url="http://localhost:8001/pipeline/3", # URL of the load tests pipeline
),
# Paths to Locust report files
csv_locust_stats_file=Path("locust_stats.csv"), # Aggregated statistics
json_locust_ratio_file=Path("locust_ratio.json"), # Response time percentiles
csv_locust_exceptions_file=Path("locust_exceptions.csv"), # Exceptions during test
csv_locust_stats_history_file=Path("locust_stats_history.csv"), # Time-series stats
)
)
# Run the async main function
asyncio.run(main())
2. CLI Usage
The package provides a built-in CLI command for uploading reports.
Example with YAML configuration
Configuration file (./examples/locust.yaml):
# Base URL of the Load Testing Hub API
api_url: http://localhost:8000
# Information about the service for which results are uploaded
service:
id: 1 # Unique service identifier
# Scenario metadata
scenario:
id: 1 # Unique scenario identifier
name: "get account" # Scenario name (for reference in the UI or reports)
file: "./scenarios/get_accounts/v1.0.conf" # Path to the scenario configuration file
version: "v1.0" # Version of the scenario
number_of_users: 500 # Number of virtual users executed in the test
runtime_duration: "3m" # Test runtime duration (3 minutes)
# CI/CD pipeline that triggered the load test execution
trigger_pipeline:
ci_job_url: "http://localhost:8001/pipeline/1/job/3" # URL of the triggering job
ci_pipeline_url: "http://localhost:8001/pipeline/1" # URL of the triggering pipeline
ci_project_version: "v1.11.0" # Project version under test
# CI/CD pipeline where the load test scenarios are located
load_tests_pipeline:
ci_job_url: "http://localhost:8001/pipeline/3/job/9" # URL of the load tests job
ci_pipeline_url: "http://localhost:8001/pipeline/3" # URL of the load tests pipeline
# Paths to Locust output files generated after test execution
csv_locust_stats_file: "locust_stats.csv" # Aggregated test statistics
json_locust_ratio_file: "locust_ratio.json" # Percentile and ratio statistics
csv_locust_exceptions_file: "locust_exceptions.csv" # Exceptions captured during the test
csv_locust_stats_history_file: "locust_stats_history.csv" # Time-series performance stats
Command:
load-testing-hub upload-locust-report --yaml-config=./examples/locust.yaml
Example with JSON configuration
Configuration file (./examples/locust.json):
{
"api_url": "http://localhost:8000",
"service": {
"id": 1
},
"scenario": {
"id": 1,
"name": "get account",
"file": "./scenarios/get_accounts/v1.0.conf",
"version": "v1.0",
"number_of_users": 500,
"runtime_duration": "3m"
},
"trigger_pipeline": {
"ci_job_url": "http://localhost:8001/pipeline/1/job/3",
"ci_pipeline_url": "http://localhost:8001/pipeline/1",
"ci_project_version": "v1.11.0"
},
"load_tests_pipeline": {
"ci_job_url": "http://localhost:8001/pipeline/3/job/9",
"ci_pipeline_url": "http://localhost:8001/pipeline/3"
},
"csv_locust_stats_file": "locust_stats.csv",
"json_locust_ratio_file": "locust_ratio.json",
"csv_locust_exceptions_file": "locust_exceptions.csv",
"csv_locust_stats_history_file": "locust_stats_history.csv"
}
Command:
load-testing-hub upload-locust-report --json-config=./examples/locust.json
Metadata
Release files for load-testing-hub 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| load_testing_hub-0.6.0.tar.gz | 19.9 kB | Without provenance | Details for load_testing_hub-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| load_testing_hub-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for load_testing_hub-0.6.0-py3-none-any.whl |
Total release size: 56.0 kB
Release files / load_testing_hub-0.6.0.tar.gz
| Download URL | load_testing_hub-0.6.0.tar.gz |
|---|---|
| Size | 19.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0141babe790c1c1bbff580f72266072ec5ad7dfc7f86423ea476fb25a3209758
|
|
BLAKE2b-256 checksum How to use checksums |
e3f224e8794b835c75c28783c02f0e0ba896e2e8c420801415d2ae2f203c23ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / load_testing_hub-0.6.0-py3-none-any.whl
| Download URL | load_testing_hub-0.6.0-py3-none-any.whl |
|---|---|
| Size | 36.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5d137e0240b4fc6f40148f3d72b49c29057c52370e13529ad8fde6b75c051c1f
|
|
BLAKE2b-256 checksum How to use checksums |
6606aa07494bf99d9845467a3b8e362e1fd1b93c4330d7fece3f3637823b506f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for load-testing-hub 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.