Kensho reporter for Robot Framework — writes kensho-results/ so the Kensho CLI can generate a rich HTML report.
Project description
kensho-robot
A Robot Framework Listener (v3) that emits the canonical Kensho v1
JSON format. Run your tests, then point the kensho CLI at kensho-results/
to get a self-contained static HTML report.
Install
pip install kensho-robot
# or, in this monorepo:
pip install -e packages/robot
Run
robot --listener kensho_robot.Listener tests/
# => kensho-results/run.json + kensho-results/cases/*.json
# Generate the HTML report (uses the JS CLI from the same monorepo):
npx kensho generate
npx kensho open
Pass listener options after a colon:
robot --listener kensho_robot.Listener:output=kensho-results:project_name=Demo tests/
| Option | Default | Effect |
|---|---|---|
output=<dir> |
kensho-results |
Output directory. |
project_name=<name> |
Unknown project |
Project name in run.json. |
project_slug=<slug> |
derived from name | Project slug (lowercase, alnum + dash/underscore). |
run_id=<id> |
run_<timestamp> |
Override the auto-generated run id. |
severity_from_tags=true |
true |
Map @critical / @severity:critical tags onto case.severity. Set to false to disable. |
What it produces
kensho-results/run.json— run manifest (project, env, totals, timing).kensho-results/cases/<stableId>.json— one file per Robot test.kensho-results/attachments/<caseId>/...— files registered viakensho_robot.attach.
Each case gets a stable id (tc_<16 hex>) hashed from its full name +
file path, so test history correlates across runs and across adapters
(JS, pytest, and Go all use the same FNV-1a-based hash).
Listener hook → Kensho mapping
| Robot hook | Effect |
|---|---|
start_suite |
Capture suite name + Documentation (used as case.behavior.feature for tests inside). |
start_test |
Open a Kensho case scratch; harvest tags/severity/links/labels. |
start_keyword |
Push a Kensho step. [Setup] / [Teardown] get phase = setup/teardown; library and user keywords get action = group. |
log_message |
Append a Log message to the active step's logs[]. |
end_keyword |
Close the step with status and duration from Robot. |
end_test |
Finalize the case; map Robot PASS/FAIL/SKIP to Kensho pass/fail/skip (or broken if a setup/teardown keyword was the failure source). Write cases/<id>.json. |
end_suite (top) |
Write run.json with totals and env. |
Tags we read
Robot tags do double duty as Kensho metadata. Aliases all work; @-prefixes
are optional.
| Tag | Effect |
|---|---|
@critical, @blocker, @normal, @minor, @trivial |
Sets case.severity. |
@severity:critical |
Same as above, explicit form. |
@feature:Cart |
Sets case.behavior.feature. |
@epic:Checkout |
Sets case.behavior.epic. |
@scenario:HappyPath / @story:HappyPath |
Sets case.behavior.scenario. |
@owner:alice |
Sets case.owner. |
@label:team=growth |
Adds case.labels.team = "growth". |
@link:https://… |
Adds a link to case.links. |
@link:jira=https://jira/PROJ-123 |
Same, with kind. |
@link:jira=https://jira/PROJ-123=PROJ-123 |
Same, with kind and label. |
| Any other tag | Becomes a free-form case.tags chip. |
*** Settings *** Documentation on the suite becomes the default
case.behavior.feature for every test inside (override per-test with
@feature:).
[Documentation] on a test becomes case.description.
[Template] My Keyword records the template name in case.parameters[].
Helper API
Import the helpers from kensho_robot. All four are no-ops outside a
running test, so it's safe to call them from shared library code.
import kensho_robot as kensho
def open_login_page():
with kensho.step("warm up CDN"):
...
with kensho.step("issue request"):
...
def attach_screenshot():
kensho.attach("/tmp/screen.png", kind="screenshot")
kensho.label("traffic", "synthetic")
kensho.link("https://jira.example.com/browse/PROJ-123",
kind="jira", label_text="PROJ-123")
| Helper | What it does |
|---|---|
with kensho.step(title, action=None): |
Open a Kensho step nested under the active keyword. On exception, the step is marked fail and re-raised. |
kensho.attach(path, kind=None, name=None, mime_type=None) |
Copy the file into kensho-results/attachments/<caseId>/ and register it on the current step (or case). |
kensho.label(key, value) |
Add a string label to the case. |
kensho.link(url, kind=None, label_text=None) |
Add a hyperlink to the case. |
kensho.current_case_id() |
Returns the stable case id of the running test, or None. |
Errors and broken vs fail
PASS→status: 'pass'.FAILfrom a test-body keyword →status: 'fail'. The Robot failure message becomescase.errors[].message; the full message goes intocase.errors[].stack.FAILwhose source is a[Setup]or[Teardown]keyword →status: 'broken'(infrastructure, not a real assertion failure).SKIP/NOT RUN→status: 'skip'.- Any other status (e.g. parse errors) →
status: 'broken'.
Environment auto-detected
GitHub Actions, CircleCI, GitLab CI, Jenkins, Buildkite, Azure DevOps — CI provider, branch, commit, run URL, OS, architecture, Python version.
Pass KR_AUTHOR, KR_COMMIT_MSG, KR_STAGE, KR_BASE_URL,
KR_APP_VERSION, KR_BUILD_NUMBER, KR_RELEASE, KR_REGION,
KR_LOCALE, KR_TRIGGER, or KR_FEATURE as env vars to populate the
matching fields on run.env.
Design notes
- Zero runtime dependencies beyond
robotframework. The schema lives in the JS workspace; we vendor the minimum (id-hashing, status mapping, env capture) inline so the adapter installs in seconds. - The listener never raises out of a hook — a broken adapter must not
break a test run. All errors come out as
warnings.warn. - IDs are stable across adapters: the FNV-1a hash matches
kensho-pytest,kensho-go, and the JS reporters byte-for-byte, so a test run on Robot rolls up to the same history as the same suite run elsewhere.
License
Apache-2.0.
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 kensho_robot-0.1.1.tar.gz.
File metadata
- Download URL: kensho_robot-0.1.1.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84bddfc828f6d89c06033fcac001f34f2bd703fda8879b3c23a29e44a9805fee
|
|
| MD5 |
7169ef019b898a59c317751c91a91538
|
|
| BLAKE2b-256 |
6f04dcaa4e4346d940e052f85bb94cb7a1dacdac86ec292af397086e491e5b38
|
Provenance
The following attestation bundles were made for kensho_robot-0.1.1.tar.gz:
Publisher:
release-pypi.yml on brandon1794/kensho
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kensho_robot-0.1.1.tar.gz -
Subject digest:
84bddfc828f6d89c06033fcac001f34f2bd703fda8879b3c23a29e44a9805fee - Sigstore transparency entry: 1742156502
- Sigstore integration time:
-
Permalink:
brandon1794/kensho@ac717e2bf4d41a0e949447f05760481fd10dd6ee -
Branch / Tag:
refs/heads/main - Owner: https://github.com/brandon1794
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@ac717e2bf4d41a0e949447f05760481fd10dd6ee -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file kensho_robot-0.1.1-py3-none-any.whl.
File metadata
- Download URL: kensho_robot-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a539ed82e195692b66dd42e4700dc52fe1248d71c28e86de375d7b8f192402b8
|
|
| MD5 |
616922fef1af9309adb0974c4e1e27e8
|
|
| BLAKE2b-256 |
f2f9c47cdf548e941f88036e438db06f99b1242c51b040ac7dbe57a76bf9120b
|
Provenance
The following attestation bundles were made for kensho_robot-0.1.1-py3-none-any.whl:
Publisher:
release-pypi.yml on brandon1794/kensho
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kensho_robot-0.1.1-py3-none-any.whl -
Subject digest:
a539ed82e195692b66dd42e4700dc52fe1248d71c28e86de375d7b8f192402b8 - Sigstore transparency entry: 1742156532
- Sigstore integration time:
-
Permalink:
brandon1794/kensho@ac717e2bf4d41a0e949447f05760481fd10dd6ee -
Branch / Tag:
refs/heads/main - Owner: https://github.com/brandon1794
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@ac717e2bf4d41a0e949447f05760481fd10dd6ee -
Trigger Event:
workflow_dispatch
-
Statement type: