|
| 1 | +# robotmk-bridge-testdatagenerator |
| 2 | + |
| 3 | +Generates synthetic test result files for [robotmk-bridge-plugin](https://github.com/simonmeggle/robotmk-bridge-plugin) testing. Produces realistic, randomized output in the formats consumed by the bridge plugin's handlers. |
| 4 | + |
| 5 | +## Supported Formats |
| 6 | + |
| 7 | +| Handler | Format | Extension | |
| 8 | +|---|---|---| |
| 9 | +| `junit` | JUnit XML | `.xml` | |
| 10 | +| `zaproxy` | OWASP ZAP XML v2.7.0 | `.xml` | |
| 11 | +| `gatling` | Gatling simulation.log v2.0 | `.log` | |
| 12 | + |
| 13 | +## Installation |
| 14 | + |
| 15 | +```bash |
| 16 | +pip install robotmk-bridge-testdatagenerator |
| 17 | +``` |
| 18 | + |
| 19 | +## CLI Usage |
| 20 | + |
| 21 | +```bash |
| 22 | +# Generate all handlers (output: tests/e2e/data/) |
| 23 | +rmkb-testgen |
| 24 | + |
| 25 | +# Specify output directory and status |
| 26 | +rmkb-testgen --output-dir /tmp/test-data --status failed |
| 27 | + |
| 28 | +# Generate specific handlers only |
| 29 | +rmkb-testgen --handlers junit gatling |
| 30 | + |
| 31 | +# Continuous mode (Ctrl+C to stop) |
| 32 | +rmkb-testgen --continuous --interval 5 |
| 33 | + |
| 34 | +# List available handlers |
| 35 | +rmkb-testgen --list |
| 36 | +``` |
| 37 | + |
| 38 | +### Options |
| 39 | + |
| 40 | +| Flag | Short | Default | Description | |
| 41 | +|---|---|---|---| |
| 42 | +| `--output-dir` | `-o` | `tests/e2e/data` | Output directory | |
| 43 | +| `--status` | `-s` | `passed` | `passed` / `failed` / `mixed` | |
| 44 | +| `--handlers` | `-H` | all | Specific handlers to generate | |
| 45 | +| `--pattern` | `-p` | `{handler}.{ext}` | Filename pattern | |
| 46 | +| `--continuous` | `-c` | off | Regenerate on interval | |
| 47 | +| `--interval` | `-i` | `5.0` | Seconds between generations | |
| 48 | +| `--list` | `-l` | — | List handlers and exit | |
| 49 | +| `--verbose` | `-v` | off | Verbose output | |
| 50 | + |
| 51 | +## Library Usage |
| 52 | + |
| 53 | +```python |
| 54 | +from robotmk_bridge_testdatagenerator import ( |
| 55 | + generate_all_handler_files, |
| 56 | + generate_handler_file, |
| 57 | + get_supported_handlers, |
| 58 | +) |
| 59 | +from pathlib import Path |
| 60 | + |
| 61 | +# Generate all handlers |
| 62 | +files = generate_all_handler_files(Path("/tmp/test-data"), test_status="mixed") |
| 63 | + |
| 64 | +# Generate a single handler |
| 65 | +generate_handler_file("junit", Path("/tmp/result.xml"), test_status="failed") |
| 66 | + |
| 67 | +# List handlers |
| 68 | +handlers = get_supported_handlers() # ['junit', 'gatling', 'zaproxy'] |
| 69 | +``` |
| 70 | + |
| 71 | +## Custom handlers.yaml |
| 72 | + |
| 73 | +By default the bundled `handlers.yaml` is used. Override via environment variable: |
| 74 | + |
| 75 | +```bash |
| 76 | +ROBOTMK_HANDLERS_YAML=/path/to/your/handlers.yaml rmkb-testgen |
| 77 | +``` |
| 78 | + |
| 79 | +## Test Status Semantics |
| 80 | + |
| 81 | +| Status | JUnit | ZAP | Gatling | |
| 82 | +|---|---|---|---| |
| 83 | +| `passed` | All pass | Low-risk alerts only | All requests OK | |
| 84 | +| `failed` | All fail | High-risk alerts | All requests KO | |
| 85 | +| `mixed` | Every 3rd fails | Low + medium risk | Every 4th KO | |
| 86 | + |
| 87 | +## License |
| 88 | + |
| 89 | +MIT |
0 commit comments