Parallel test execution for Behave BDD via native ITestRunner.
Project description
behave-pool
Parallel test execution for Behave BDD via
native ITestRunner. Workers run in isolated processes with spawn start
method for clean interpreter state on every platform.
Features
- Native ITestRunner — Registered via
--runner=orbehave.ini. Zero monkey-patching. - Process isolation —
spawnstart method ensures clean state in every worker, on every OS. - Dynamic dispatch —
multiprocessing.Process+Queue. Workers consume work units as they finish. - @serial tag — Non-parallelizable scenarios run sequentially after the parallel phase.
- LPT load balancing — Historical durations for optimal work distribution.
- Timing persistence —
.behave-pool-timing.jsonstores durations between runs. - Unified JSON report — Merges all worker reports into a single
behave-modern-json-reportExecutionReport (schema v1.1.0) with statistics, environment info, and full feature/scenario/step details. - Ecosystem integration — Optional
behave-priority,behave-modern-json-report. The unified report is directly consumable by any tool in the ecosystem. - Zero heavy dependencies — Only stdlib
multiprocessing+behave>=1.3.0.
Installation
pip install behave-pool
Quick start
-
Register the runner in your
behave.ini:[behave.runners] parallel = behave_pool:ParallelRunner
-
Run Behave with parallel workers:
behave --runner=parallel --parallel 4 --parallel-scheme feature features/
How it works
┌─────────────────────────────────────────────────┐
│ ParallelRunner │
│ │
│ 1. Plan — parse features, create work units │
│ 2. Split — separate @serial from parallel │
│ 3. Dispatch — N workers consume from queue │
│ 4. Collect — gather results, update timings │
│ 5. Serial — run @serial units one at a time │
└─────────────────────────────────────────────────┘
│ │
┌────▼────┐ ┌────▼────┐
│ Worker 0 │ │ Worker N │
│ (spawn) │ ... │ (spawn) │
│ │ │ │
│ parse │ │ parse │
│ features │ │ features │
│ run │ │ run │
│ report │ │ report │
└──────────┘ └──────────┘
Each worker runs in an isolated process with the spawn start method,
guaranteeing a clean interpreter state regardless of OS or Python version.
Workers consume work units from a shared JoinableQueue and write
WorkerResult objects back to a result queue. The coordinator collects
results, persists timings, and returns the aggregated exit code.
CLI options
| Option | Default | Description |
|---|---|---|
--parallel N |
1 |
Number of worker processes. 1 = sequential passthrough. |
--parallel-scheme |
feature |
Parallelization unit: feature (scenario planned for future). |
--parallel-balance |
lpt |
Work ordering: lpt (longest first) or fifo (insertion order). |
--parallel-timing-file |
.behave-pool-timing.json |
Path to timing file for LPT balancing. |
--parallel-report |
behave-pool-report.json |
Path to unified JSON report (behave-modern-json-report format). |
Usage
Feature-level parallelization
Each feature file runs in its own worker process. Workers are dispatched dynamically and consume work units from a shared queue.
# 4 worker processes, LPT balancing
behave --runner=parallel --parallel 4 features/
Serial scenarios
Tag scenarios with @serial to run them sequentially after all parallel work units complete:
@serial
Scenario: Database migration
Given the database is empty
When I run the migration
Then all tables should exist
LPT load balancing
By default, behave-pool uses Longest Processing Time (LPT) scheduling. It stores historical durations in .behave-pool-timing.json and dispatches the slowest features first, minimizing total wall-clock time.
# Use FIFO ordering instead of LPT
behave --runner=parallel --parallel 4 --parallel-balance fifo features/
Unified JSON report
After all workers finish, behave-pool merges their results into a single
JSON report in the behave-modern-json-report
ExecutionReport format (schema v1.1.0). This report includes:
- Execution metadata — unique ID, status, duration, timestamps.
- Aggregate statistics — feature/scenario/step counts, pass rate, error count, per-tag breakdown.
- Environment info — Python and Behave versions, OS, CI provider, git branch/commit.
- Full feature tree — features, scenarios, and steps with IDs, locations, durations, errors, and tracebacks.
# Default report path
behave --runner=parallel --parallel 4 features/
# → writes behave-pool-report.json
# Custom report path
behave --runner=parallel --parallel 4 \
--parallel-report reports/run.json \
features/
Any tool built for the behave-modern-json-report ecosystem (HTML formatters,
dashboards, AI analyzers) can consume the parallel report directly — no
conversion needed.
behave.ini configuration
All CLI options can also be set in behave.ini:
[behave]
parallel = 4
parallel-scheme = feature
parallel-balance = lpt
parallel-timing-file = .behave-pool-timing.json
parallel-report = behave-pool-report.json
Requirements
- Python >=3.11
- behave >=1.3.0
Example
A complete working example is included in examples/calculator/.
It demonstrates parallel execution, @serial scenarios, and the unified JSON report:
cd examples/calculator
behave --runner=parallel --parallel 4
# → runs 3 scenarios (2 parallel + 1 @serial)
# → writes behave-pool-report.json with ExecutionReport format
Documentation
Full documentation is available at https://mathiaspaulenko.github.io/behave-pool/.
Contributing
Contributions are welcome! See CONTRIBUTING.md for setup instructions and guidelines.
Please review our Code of Conduct before participating.
Changelog
See CHANGELOG.md for notable changes.
License
MIT — Copyright (c) 2026 Mathias Paulenko
Acknowledgements
- Behave — the BDD framework this library extends.
- Contributor Covenant — Code of Conduct.
- Keep a Changelog — Changelog format.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file behave_pool-1.1.2.tar.gz.
File metadata
- Download URL: behave_pool-1.1.2.tar.gz
- Upload date:
- Size: 63.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
355b3d402387f2fff7796a99409465c3f42846fd5b38234563f5561f7b88857f
|
|
| MD5 |
d981d7c92a8c148e4eb3e7de4673b20d
|
|
| BLAKE2b-256 |
7a64e60b3fe72d22448ab1c1f1cdd624387c95b968b18d20379b3413b37f7b76
|
Provenance
The following attestation bundles were made for behave_pool-1.1.2.tar.gz:
Publisher:
release.yml on MathiasPaulenko/behave-pool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
behave_pool-1.1.2.tar.gz -
Subject digest:
355b3d402387f2fff7796a99409465c3f42846fd5b38234563f5561f7b88857f - Sigstore transparency entry: 2303529142
- Sigstore integration time:
-
Permalink:
MathiasPaulenko/behave-pool@c4208f09674646500372f3becaa9dda040f3eb63 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MathiasPaulenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c4208f09674646500372f3becaa9dda040f3eb63 -
Trigger Event:
push
-
Statement type:
File details
Details for the file behave_pool-1.1.2-py3-none-any.whl.
File metadata
- Download URL: behave_pool-1.1.2-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
079b118fefcad914477ab3ee36c861d93b3d4f9447504808e65111ff8a4bff60
|
|
| MD5 |
206a97708071fccfede2a30b8c468608
|
|
| BLAKE2b-256 |
18cdea4143e0e3f11445167328c36681806797c771b93f74225cfd8c2f3aee45
|
Provenance
The following attestation bundles were made for behave_pool-1.1.2-py3-none-any.whl:
Publisher:
release.yml on MathiasPaulenko/behave-pool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
behave_pool-1.1.2-py3-none-any.whl -
Subject digest:
079b118fefcad914477ab3ee36c861d93b3d4f9447504808e65111ff8a4bff60 - Sigstore transparency entry: 2303529199
- Sigstore integration time:
-
Permalink:
MathiasPaulenko/behave-pool@c4208f09674646500372f3becaa9dda040f3eb63 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MathiasPaulenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c4208f09674646500372f3becaa9dda040f3eb63 -
Trigger Event:
push
-
Statement type: