Flaktor
Flaky test detection made simple.
Flaktor is a framework-agnostic CLI tool that tracks your test results over time and identifies flaky tests - tests that sometimes pass and sometimes fail without code changes.
Features
- Framework Agnostic: Works with any test framework that outputs JUnit/xUnit XML
- Simple CLI: Easy-to-use commands for uploading results and viewing reports
- Flaky Detection: Automatically detects tests with inconsistent results
- CI/CD Ready: Built-in support for GitHub Actions, GitLab CI, and more
- Beautiful Output: Rich terminal output with tables and colored status
- Lightweight: SQLite database with no external dependencies
Installation
pip install flaktor
Quick Start
# Initialize the database
flaktor init
# Run your tests with JUnit XML output
pytest --junitxml=results.xml tests/
# Upload results
flaktor upload results.xml
# View flaky tests
flaktor list --flaky
# Generate a report
flaktor report
Commands
| Command | Description |
|---|---|
flaktor init |
Initialize the database |
flaktor upload <files> |
Upload test results from XML files |
flaktor list |
List tests with statistics |
flaktor list --flaky |
Show only flaky tests |
flaktor history <test> |
View detailed history for a test |
flaktor report |
Generate a test health report |
flaktor clean |
Remove old data from the database |
flaktor info |
Show database information |
flaktor mcp |
Start the MCP server for AI coding agents |
CI/CD Integration
Flaktor is designed for CI/CD pipelines. Track test results across runs to detect flaky tests.
GitHub Actions
- name: Upload to Flaktor
run: |
flaktor upload results.xml \
--branch "${{ github.ref_name }}" \
--commit "${{ github.sha }}"
GitLab CI
script:
- flaktor upload results.xml --branch "$CI_COMMIT_REF_NAME" --commit "$CI_COMMIT_SHA"
See docs/ci-cd-integration.md for complete examples for:
- GitHub Actions
- GitLab CI/CD
- Jenkins
- CircleCI
- Azure DevOps
MCP Server (for AI coding agents)
Flaktor can expose its flaky-test data to AI coding agents (Claude Code, Cursor, etc.) over the Model Context Protocol, so an agent can check whether a failing test is a known flake before debugging it as a real bug. The server is read-only — upload, init, and clean stay CLI-only.
pip install "flaktor[mcp]"
Add it to your MCP client config, e.g. for Claude Code:
claude mcp add flaktor -- flaktor mcp
Available tools: list_flaky_tests, check_test_flakiness, get_test_history, get_test_summary, get_database_stats.
Understanding Flakiness
Flaktor calculates a "flip rate" for each test:
flip_rate = 2 * min(pass_rate, fail_rate)
- A test that always passes: flip_rate = 0%
- A test that always fails: flip_rate = 0%
- A test that passes 50% of the time: flip_rate = 100% (most flaky)
- A test that passes 80% of the time: flip_rate = 40%
Tests with a flip rate above 20% (default threshold) are considered flaky.
Example Output
$ flaktor list --flaky
Flaky Tests (last 30 days)
+----------------------------------------+------+------+------+-----+--------+
| Test Name | Flip | Pass | Runs | P/F | Avg |
+----------------------------------------+------+------+------+-----+--------+
| test_api.TestAuth.test_token_refresh | 80% | 60% | 25 | 15/10 | 0.45s |
| test_db.TestConn.test_reconnect | 60% | 70% | 20 | 14/6 | 1.23s |
| test_ui.TestLogin.test_remember_me | 40% | 80% | 15 | 12/3 | 2.10s |
+----------------------------------------+------+------+------+-----+--------+
Development
# Clone the repository
git clone https://github.com/PanjatanCoders/flaktor.git
cd flaktor
# Install in development mode
pip install -e .
# Run tests
pytest tests/ -v
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Metadata
Release files for flaktor 0.1.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 | |
|---|---|---|---|
| flaktor-0.1.0.tar.gz | 35.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flaktor-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.2 kB
Release files / flaktor-0.1.0.tar.gz
| Download URL | flaktor-0.1.0.tar.gz |
|---|---|
| Size | 35.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74d4aad569c5b018da995dd69f3f7beb7efd2bd44bff1990fa7d89b229328799
|
|
BLAKE2b-256 checksum How to use checksums |
9c52c451b4d597cedd0fdb78af58c5b84025ae27048b42ebad4889b9e4380153
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / flaktor-0.1.0-py3-none-any.whl
| Download URL | flaktor-0.1.0-py3-none-any.whl |
|---|---|
| Size | 27.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9320a5d227f414acec1e3fe3932cc9116a9b7479506684b8d33cfe023c07c6fd
|
|
BLAKE2b-256 checksum How to use checksums |
9db5068715711feaef0216e3bd580658c35afe134b951c344005b3303da77db2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency log