Skip to main content

BenchMind

BenchMind is an open-source, pluggable load testing framework that turns API contracts into runnable, engine-agnostic load tests. It eliminates the need to hand-write load test scripts by deriving traffic patterns directly from your OpenAPI specification and can be extended to support other spec formats and load engines through a plugin architecture.

Status: Early MVP. Currently supports OpenAPI-to-k6 generation and local execution. The plugin architecture and TestPlan schema are in place, enabling future adapters for Locust, JMeter, Gatling, Artillery, AsyncAPI, GraphQL, gRPC, and more.

Features

  • OpenAPI-native: Parse OpenAPI 3.0/3.1 specs in JSON or YAML.
  • Automatic script generation: Produce k6 JavaScript load tests from endpoints, parameters, and request bodies.
  • Local execution: Run generated tests with a local k6 binary or Docker.
  • Metrics summary: See p50, p95, p99 latency, request rate, and error rate at a glance.
  • Benchmark comparison: Compare BenchMind-generated scripts against hand-written baselines.
  • Plugin-ready: List adapters and add engine/spec adapters through a JSON-RPC plugin contract.
  • CLI-first: Simple commands for generating, validating, running, comparing, and managing plugins.

Installation

Requires Python 3.11+ and k6 (or Docker).

pip install benchmind

For development:

git clone https://github.com/yourorg/benchmind.git
cd benchmind
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Quick Start

1. Generate a k6 script from an OpenAPI spec

benchmind generate examples/petstore.yaml --output petstore-load.js

2. Validate the generated script

benchmind validate petstore-load.js

3. Run the load test

benchmind run petstore-load.js --vus 10 --duration 30s

Or run directly from a spec:

benchmind run examples/petstore.yaml --vus 10 --duration 30s

4. Compare against a hand-written baseline

benchmind compare examples/petstore.yaml --baseline baseline.js --report report.json

5. List available adapters

benchmind plugin list

Docker Usage

Build the image:

docker build -t benchmind:latest .

Generate a script inside a container:

docker run --rm -v "$(pwd)/examples:/app/examples:ro" -v "$(pwd)/output:/app/output" \
  benchmind:latest generate examples/petstore.yaml --output output/petstore-load.js

Or use Docker Compose:

docker compose up

Example

Given the OpenAPI spec in examples/petstore.yaml, BenchMind generates a k6 script that:

  • Lists pets with a realistic read ratio.
  • Creates a pet with a generated request body.
  • Handles path parameters and status assertions.
import http from 'k6/http';
import { check } from 'k6';

export const options = {
  stages: [
    { duration: '10s', target: 10 },
    { duration: '20s', target: 10 },
    { duration: '10s', target: 0 },
  ],
  thresholds: {
    http_req_duration: ['p(95)<500'],
    http_req_failed: ['rate<0.1'],
  },
};

export default function () {
  const res = http.get('https://petstore.example.com/v1/pets');
  check(res, { 'status is 200': (r) => r.status === 200 });
}

Architecture

BenchMind is built around a language-agnostic TestPlan model and a plugin architecture. Spec adapters convert API contracts into TestPlan objects, engine adapters convert TestPlan objects into load-test scripts and run them, and reporters produce output in various formats.

Core modules:

  • src/benchmind/models.py — TestPlan, TestStep, RunResult, and plugin models.
  • src/benchmind/plugins.py — plugin manager, adapter base classes, and subprocess JSON-RPC runner.
  • src/benchmind/adapters/openapi.py — built-in OpenAPI spec adapter.
  • src/benchmind/adapters/k6.py — built-in k6 engine adapter.
  • src/benchmind/openapi_parser.py — low-level OpenAPI parsing.
  • src/benchmind/k6_generator.py — k6 script generation.
  • src/benchmind/runner.py — k6 execution with local binary or Docker.
  • src/benchmind/metrics.py — k6 summary parsing and RunResult formatting.
  • src/benchmind/benchmark.py — compare generated scripts against baselines.
  • src/benchmind/cli.py — command-line interface.

See docs/ARCHITECTURE.md and docs/adrs/003-plugin-architecture.md for the full design.

Development

Run the test suite:

pytest

Run linting:

ruff check src tests
mypy src

Or use the Makefile:

make check

Learn More

Roadmap

  1. Telemetry integration (CloudWatch, X-Ray, OpenTelemetry).
  2. Traffic ratio learning from ALB access logs.
  3. Distributed execution on AWS Fargate and EKS.
  4. Human-reviewed remediation suggestions.
  5. MCP server for IDE integration.

License

Apache 2.0

Contributing

Contributions are welcome. Please open an issue first to discuss major changes, and ensure all changes include tests.

Metadata

Release files for benchmind 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for benchmind 0.1.0
File Size Uploaded Provenance Actions
benchmind-0.1.0.tar.gz 232.9 kB Without provenance Details for benchmind-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for benchmind 0.1.0
File Interpreter ABI Platform Actions
benchmind-0.1.0-py3-none-any.whl Python 3 none any Details for benchmind-0.1.0-py3-none-any.whl

Total release size: 260.1 kB

Release files / benchmind-0.1.0.tar.gz

Download URL benchmind-0.1.0.tar.gz
Size 232.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7caf305bba442142c9104d7af87a83f2e3e8352c3215bdcd95d7ec091fb82d1f
BLAKE2b-256 checksum
How to use checksums
fb55a9953a5e3dd55f35daa26fdfef2ece1270d0631f553bc8cbd805f96032aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / benchmind-0.1.0-py3-none-any.whl

Download URL benchmind-0.1.0-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39e69caa161d381fa048dea8404487cd53095389489933fc246b6654530b6383
BLAKE2b-256 checksum
How to use checksums
cd757184a931577776a30722a4da28f1fb122b50db3bf32f407e4e4879c7feaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for benchmind 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page