Report Enrichment
Auto-enrich testrelic-pytest results from Allure and JUnit reports — steps, attachments, severity, labels, and failure detail merged onto each test.
testrelic-pytest can automatically enrich its results with data from Allure and JUnit reports produced during the same run. When enrichment is on, each uploaded test carries the extra structure those reporters captured — steps, attachments, severity, labels, and richer failure detail — without any code changes.
How it works
At the end of the session the plugin looks for report output to merge:
- an Allure results directory (the one you pass to
--alluredir), or - a JUnit XML file.
When it finds one, it reads each entry and merges the matching data onto the corresponding TestRelic result. Allure and JUnit data are combined per test, so you can run both and get the union.
Enrichment is enabled by default. It is best-effort: if no report is found, or a file can't be parsed, the run still uploads normally.
What gets merged
Enrichment adds these per-test fields:
| Field | Source | What it carries |
|---|---|---|
steps | Allure | Ordered test steps with status |
attachments | Allure | Files attached during the test (logs, screenshots, payloads) |
severity | Allure | The test's severity label (blocker, critical, normal, …) |
artifacts | Allure | Uploaded attachment references |
| failure detail | Allure / JUnit | Failure message and trace, when richer than the live result |
| tags | Allure / JUnit | Allure labels; JUnit <properties> |
The Allure title and flaky flag are merged onto the test as well, so the cloud view matches what your Allure report showed. JUnit XML carries no steps or attachments, so it contributes failure detail and tags only. Live pass/fail status and timing always come from the run itself.
Attachments are uploaded to TestRelic cloud storage and linked from the test, so you can open them from the Run / Test detail view.
tests/test_checkout.py:48: in test_checkout_confirms_order
A hand-recreated before/after of the same failed test — toggle After enrichment to see the Allure steps, attachments, and severity plus the JUnit failure detail merged on.
Enabling and pointing at reports
By default the plugin auto-detects the Allure directory (from --alluredir) and a JUnit XML file. Use the flags below to set explicit paths or to turn enrichment off:
| Flag | Env var | Purpose |
|---|---|---|
--testrelic-pytest-no-enrich | TESTRELIC_NO_ENRICH=1 | Disable report enrichment |
--testrelic-pytest-allure-dir <dir> | TESTRELIC_ALLURE_DIR | Explicit Allure results directory |
--testrelic-pytest-junit-xml <file> | TESTRELIC_JUNIT_XML | Explicit JUnit XML file |
# Generate Allure + JUnit output, then upload enriched results
pytest --alluredir=allure-results --junitxml=report.xml# Point at explicit paths
pytest \
--testrelic-pytest-allure-dir allure-results \
--testrelic-pytest-junit-xml report.xmlEnrichment reads the allure-results directory directly, so neither format needs an extra. To produce Allure results in the first place, you can co-install allure-pytest with the convenience extra:
pip install "testrelic-pytest[allure]"Enrichment runs at session end, after your tests finish, so it never changes test outcomes — it only adds detail to what is uploaded.