Skip to main content

robotframework-events

A Robot Framework listener that writes every suite, test, keyword, control structure and log message of a run as JSON Lines, while the run happens. Item ids are Robot Framework's own (s1-t2-k3), so events join with output.xml and link into log.html#<id>.

Requires Robot Framework 7.0 or newer and Python 3.10 or newer. Status: alpha.

pip install robotframework-events
robot --listener robotframework_events.Listener tests/                       # writes events.jsonl next to output.xml
robot --listener "robotframework_events.Listener;file=ev.jsonl;level=DEBUG" tests/

Listener arguments: file (NONE for no file), level (minimum message level, default INFO), messages, args, structures (each true/false, default true) and max_text (default 4096).

Event format

One JSON object per line. Every event has v (format version), seq (1, 2, 3, ...), t (Unix time) and type: run.started, suite.started, test.started, step.started, message.logged, step.ended, test.ended, suite.ended, status.changed, resultfile.created, run.ended.

{"v":1,"seq":6,"t":1791581563.542,"type":"test.started","id":"s1-t1","parent":"s1","name":"Passing","longname":"Sample.Passing","lineno":6}
{"v":1,"seq":61,"t":1791581563.601,"type":"test.ended","id":"s1-t2","status":"FAIL","message":"1 != 2","elapsed":0.004}

The JSON Schema events-v1.schema.json is the reference.

Command line

rfevents tail -f results/events.jsonl          # follow a run in the terminal, keyword by keyword
rfevents tail --steps 2 --level INFO events.jsonl
rfevents convert output.xml -o events.jsonl    # events for a run recorded without the listener

tail prints suites, tests, steps down to --steps levels (default 1), log messages from --level (default WARN) and a summary. convert reads output.xml or output.json; steps then have no source or line number, which result files do not store.

Python API

from robotframework_events import RunState, add_callback, convert, read_events

state = RunState.from_events(read_events("events.jsonl"))  # also .jsonl.gz
print(state.status, state.counts())
for event in read_events("events.jsonl", follow=True):  # while the run writes it
    ...

events = list(convert("output.xml"))  # dicts, as the listener writes them
add_callback(fn)  # in-process consumers, e.g. robotcode's debugger

read_events gives typed events (robotframework_events.events). RunState holds the tree of suites, tests and steps with status, messages and times, and the running test and step.

Development

pip install -e .[dev]
ruff check . && ruff format --check . && mypy
pytest                 # format, options, schema, reader, CLI and conformance tests
pytest -m bench        # listener overhead
pytest -m e2e          # through robotcode's debugger (needs ../robotcode)

The conformance tests also run on Robot Framework's acceptance test data, found through RF_ATEST_DIR or at ../robotframework/atest/testdata, and are skipped when it is missing.

Licence

MIT

Metadata

Release files for robotframework-events 0.2.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 robotframework-events 0.2.0
File Size Uploaded Provenance
robotframework_events-0.2.0.tar.gz 31.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-events 0.2.0
File Interpreter ABI Platform
robotframework_events-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 56.5 kB

Release files / robotframework_events-0.2.0.tar.gz

Download URL robotframework_events-0.2.0.tar.gz
Size 31.6 kB
Tags Source
SHA-256 checksum
How to use checksums
208196cb5a98da01d2ff23a83adcd81f8f808978b84ba8546a3da45ceacefd40
BLAKE2b-256 checksum
How to use checksums
8ba032ad9a94d833ca3c6ab411970aa955721a06e0cf7904b1614dd6da97ffd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Release files / robotframework_events-0.2.0-py3-none-any.whl

Download URL robotframework_events-0.2.0-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d53e459cc05bbbb4ee6a00c4bbac85c199f7cccc36681a6d571e8c138df537f
BLAKE2b-256 checksum
How to use checksums
a58388b732d3d8785375e9cbc2a8b7c2f5c02ee081d80473af67caf6a9810b01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Security for robotframework-events 0.2.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.

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