Skip to main content

Generates synthetic test result files (JUnit, ZAP, Gatling, Locust) for robotmk-bridge-plugin testing

Project description

robotmk-bridge-testdatagenerator

Generates synthetic test result files for robotmk-bridge-plugin testing. Produces realistic, randomized output in the formats consumed by the bridge plugin's handlers.

Supported Formats

Handler Format Extension Default count
junit JUnit XML .xml 5 test cases
zaproxy OWASP ZAP XML v2.7.0 .xml 3 sites
gatling Gatling simulation.log v2.0 .log 10 requests
locust Locust stats CSV .csv 5 endpoints

Quick Start with uv

uv is the recommended way to run this tool.

Run without installing (one-liner)

uvx --from robotmk-bridge-testdatagenerator rmkb-testgen --list
uvx --from robotmk-bridge-testdatagenerator rmkb-testgen --output-dir /tmp/test-data

Install as a persistent tool

uv tool install robotmk-bridge-testdatagenerator
rmkb-testgen --help

# Upgrade later
uv tool upgrade robotmk-bridge-testdatagenerator

# Uninstall
uv tool uninstall robotmk-bridge-testdatagenerator

Development Setup with uv

git clone https://github.com/elabit/robotmk-bridge-testdatagenerator.git
cd robotmk-bridge-testdatagenerator

# Install package + all dev dependencies (pytest, ruff, etc.)
uv sync

# Run the CLI from source
uv run rmkb-testgen --list
uv run rmkb-testgen --output-dir /tmp/test-data --verbose

# Build distributable artifacts
uv build
# -> dist/robotmk_bridge_testdatagenerator-*.whl
# -> dist/robotmk_bridge_testdatagenerator-*.tar.gz

# Editable install (changes take effect immediately, no reinstall needed)
uv pip install -e .

# Install local wheel into another project
uv add /path/to/dist/robotmk_bridge_testdatagenerator-0.2.0-py3-none-any.whl

Testing

# Run all tests (unit + acceptance)
uv run pytest

# Run with coverage report
uv run pytest --cov

# Run only unit tests
uv run pytest tests/unit/

# Run only acceptance tests (CLI + library API)
uv run pytest tests/acceptance/

# Lint
uv run ruff check src/ tests/
Test layer Location What it covers
Unit tests/unit/ Each generator in isolation: file creation, format validity, status semantics
Acceptance tests/acceptance/ CLI via subprocess (rmkb-testgen), public library API (generate_*)

CLI Reference

rmkb-testgen [options]
python -m robotmk_bridge_testdatagenerator [options]
Flag Short Default Description
--output-dir PATH -o tests/e2e/data Output directory
--status -s passed passed / failed / mixed
--handlers HANDLER... -H all Generate specific handlers only
--count [HANDLER=]N -n handler default Item count (repeatable)
--pattern -p {handler}.{ext} Filename pattern
--continuous -c off Regenerate on interval
--interval SECS -i 5.0 Seconds between continuous runs
--list -l List available handlers and exit
--verbose -v off Verbose output

Examples

# List available handlers
rmkb-testgen --list

# Generate all with defaults
rmkb-testgen --output-dir /tmp/test-data

# Specific status
rmkb-testgen --status failed --output-dir /tmp/test-data

# Specific handlers only
rmkb-testgen --handlers junit gatling --output-dir /tmp/test-data

# Control item count — all handlers
rmkb-testgen --count 20 --output-dir /tmp/test-data

# Per-handler counts
rmkb-testgen -n junit=20 -n gatling=50 -n zaproxy=2 -n locust=8 --output-dir /tmp/test-data

# Continuous regeneration (Ctrl+C to stop)
rmkb-testgen --continuous --interval 5 --output-dir /tmp/test-data

# Custom handlers.yaml
ROBOTMK_HANDLERS_YAML=/path/to/handlers.yaml rmkb-testgen --output-dir /tmp/test-data

Library Usage

from robotmk_bridge_testdatagenerator import (
    generate_all_handler_files,
    generate_handler_file,
    get_supported_handlers,
)
from pathlib import Path

# Generate all handlers
files = generate_all_handler_files(
    output_dir=Path("/tmp/test-data"),
    test_status="mixed",
    handler_kwargs={
        "junit":   {"num_tests": 20},
        "gatling": {"num_requests": 50},
        "zaproxy": {"num_sites": 2},
        "locust":  {"num_endpoints": 8},
    },
)

# Generate a single handler
generate_handler_file(
    handler_name="junit",
    output_path=Path("/tmp/result.xml"),
    test_status="failed",
    num_tests=10,
)

# List available handlers
handlers = get_supported_handlers()  # ['junit', 'gatling', 'zaproxy', 'locust']

Test Status Semantics

Status JUnit ZAP Gatling Locust
passed All pass Low-risk alerts only All requests OK 0 failures
failed All fail High-risk alerts All requests KO 50%+ failures per endpoint
mixed Every 3rd fails Low + medium risk Every 4th KO Every 2nd endpoint has failures

handlers.yaml

The handler registry is bundled with the package. Override for custom handler definitions:

ROBOTMK_HANDLERS_YAML=/path/to/your/handlers.yaml rmkb-testgen --output-dir /tmp/test-data

Installation without uv

pip install robotmk-bridge-testdatagenerator
rmkb-testgen --help

License

GPLv2, see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotmk_bridge_testdatagenerator-0.5.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file robotmk_bridge_testdatagenerator-0.5.0.tar.gz.

File metadata

File hashes

Hashes for robotmk_bridge_testdatagenerator-0.5.0.tar.gz
Algorithm Hash digest
SHA256 3545787b52d8a9771036996c5196d00e57cb0e6342cd4cc7897ab2c5ea9d4abb
MD5 8775f6ebcd854ed3ed52888be0fa1efe
BLAKE2b-256 05371c41e209a18c47b6080008b607ba631de11871bbacb95f341c93a73f549f

See more details on using hashes here.

Provenance

The following attestation bundles were made for robotmk_bridge_testdatagenerator-0.5.0.tar.gz:

Publisher: release-please.yml on elabit/robotmk-bridge-testdatagenerator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file robotmk_bridge_testdatagenerator-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for robotmk_bridge_testdatagenerator-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dde679b9316272cc860c8bccc4d9f68ee4c5151b68f3258ba6d3e2d34aaf589f
MD5 71231e559d9647e0ce30beccb9790f70
BLAKE2b-256 a15d5b6c36af1d6006bc1f6c2fc3135f064e16be76e3a54f3e91fcbb0934d6f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for robotmk_bridge_testdatagenerator-0.5.0-py3-none-any.whl:

Publisher: release-please.yml on elabit/robotmk-bridge-testdatagenerator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page