Skip to main content

HTML report generator for Robot Framework — rich, self-contained reports with API logging, deep-diff, JSON Schema validation, image comparison, and screenshot annotation.

Project description

robotframework-xlibrary-result

PyPI version Python versions License: MIT Robot Framework

Rich HTML reports for Robot Framework — API request/response logging, deep-diff comparison viewer, JSON Schema validation, image comparison, and annotated screenshots, all in a single self-contained test_result.html.

Installation

pip install robotframework-xlibrary-result

Optional feature groups:

pip install "robotframework-xlibrary-result[schema]"   # adds jsonschema for VALIDATE JSON SCHEMA
pip install "robotframework-xlibrary-result[imaging]"  # adds opencv + imageio for advanced image diff
pip install "robotframework-xlibrary-result[all]"      # everything

Quick start (Robot Framework)

*** Settings ***
Library    robotframework_xlibrary_result.XLibraryResult
Library    RequestsLibrary

Suite Setup       Init Report
Suite Teardown    Finalise Report

*** Variables ***
${REPORT_PATH}    ${OUTPUT_DIR}/test_result.html
@{EXEC_RESULTS}   @{EMPTY}

*** Test Cases ***
TC01 — Get user list
    SET CURRENT TEST CASE ID    TC01
    APPEND STEP TITLE           execution
    ${resp}=    GET    https://api.example.com/users
    Append Request and Response to HTML Report
    ...    GET /users    PASS    request_data=${None}    response_data=${resp.json()}
    ...    http_method=GET    http_status_code=${resp.status_code}    url=${resp.url}
    Compare Dict to Dict    ${resp.json()}    {"status": "ok"}    Verify status field

*** Keywords ***
Init Report
    ${LIB}=    Get Library Instance    robotframework_xlibrary_result.XLibraryResult
    ${EMPTY}=  Create Dictionary
    Setup Generate HTML Report    ${LIB}    ${REPORT_PATH}    Demo Suite
    ...    ${EMPTY}    ${EMPTY}    Robot Framework user

Finalise Report
    Write Steps To HTML    ${REPORT_PATH}    PASS    ${EXEC_RESULTS}

Quick start (pure Python)

from robotframework_xlibrary_result import XLibraryResult, load_report_config

# Load config (falls back to bundled defaults/report.yaml when no project YAML exists)
config = load_report_config(".")
print(config["tool"]["name"])  # → "XLibrary Result"

xr = XLibraryResult()
xr.append_step_to_list(
    step_title="Sanity check",
    result="PASS",
    description="Library imports correctly.",
)

What's in the report

Feature Keyword Description
Test step log APPEND STEP TO HTML RESULT Title, status badge, duration bar, attachments
API request APPEND STEP REQUEST HTML RESULT Headers / body / cURL tabs, sensitive masking
Combined req+resp Append Request and Response to HTML Report Side-by-side, HTTP method/status badge
Dict diff Compare Dict to Dict 3-mode viewer (Table / JSON / Inline), ignore fields/paths
List diff Compare List of Dict to List of Dict Card-per-item with field-level diff
Schema validation VALIDATE JSON SCHEMA Draft-7, rich tree-style error rendering
Image diff xCompare Images Pixel / histogram / template / ORB algorithms
Screenshot Capture Screenshot Desktop + mobile (ADB / xcrun) + Flutter; auto-annotated

Configuration

The library searches for CONFIG/REPORT_CONFIG/report.yaml upwards from your test file. If none is found, it falls back to the bundled defaults/report.yaml inside the installed package — so it works out-of-the-box with no setup.

Override only the keys you care about:

project:
  name: "My Awesome API"
  logo: "https://example.com/logo.png"
  subtitle: "Smoke + regression"

tool:
  version: "v2.5.1"

footer:
  powered_by: "Powered by Robot Framework"
  copyright:  {year} Acme Corp"

report:
  auto_open: true
  filename: "smoke_2025_q4"

See src/robotframework_xlibrary_result/defaults/report.yaml for the full schema with comments.

Compatibility

  • Python: 3.9 – 3.13
  • Robot Framework: 6.0+
  • OS: macOS, Linux, Windows

Development

git clone https://github.com/Khrx1999/robotframework-xlibrary-result.git
cd robotframework-xlibrary-result
pip install -e ".[dev,all]"
pytest                              # smoke tests
ruff check src tests                # lint
python -m build                     # build sdist + wheel

Publishing to PyPI

# Modern approach (recommended)
python -m build
twine upload --verbose dist/*

# Legacy approach (also supported)
python setup.py sdist bdist_wheel
twine upload --verbose dist/*

🔐 Security tip: store your token in ~/.pypirc (chmod 600) or in your OS keyring — never paste it into a chat / commit / source file.

Contributing

Contributions are welcome! Please open an issue first to discuss any significant changes. For bug fixes, send a pull request directly with:

  1. Failing test reproducing the bug.
  2. Fix.
  3. Test passing.

License

MIT — see LICENSE.

Copyright © 2026 Tassana Khrueawan.

Origin

Originally extracted from the Automate V3 internal Robot Framework framework — refactored into a standalone, pip-installable library so the wider community can benefit.

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

robotframework_xlibrary_result-1.0.0.tar.gz (134.9 kB view details)

Uploaded Source

Built Distribution

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

robotframework_xlibrary_result-1.0.0-py3-none-any.whl (143.6 kB view details)

Uploaded Python 3

File details

Details for the file robotframework_xlibrary_result-1.0.0.tar.gz.

File metadata

File hashes

Hashes for robotframework_xlibrary_result-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9d72d51cd6e2f7903ce59d9dda6ea8395af3d6f85b28802984fe80dd9d25a823
MD5 2d0dd22f87ced7c5b0658f56c0b4d53b
BLAKE2b-256 d0641e4be6fa9c322e99674280639fe9ac5b4aed2ac5e32a32cc1efcff27a7e8

See more details on using hashes here.

File details

Details for the file robotframework_xlibrary_result-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for robotframework_xlibrary_result-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25393d39a7c6af4f785519c6e773d37e065ed431a31f3969aaa034de4f322b4a
MD5 9bf054c98467f11c29ebe3d5e7159c61
BLAKE2b-256 d15c6c4370a1753d2bbc212cc2443c341f999fe66282b9555259e0dbd1a30e2e

See more details on using hashes here.

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