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 Robot Framework License: MIT

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


Table of Contents


Features

  • Self-contained HTML report — single file, no external assets, ready to share or attach to CI artifacts.
  • API request / response logger — headers, body, cURL preview, status badge, sensitive-data masking.
  • Deep-diff data comparator — Dict ↔ Dict, List ↔ List, Dict ↔ List with 3 viewer modes (Table / JSON / Inline).
  • JSON Schema validation — Draft-7 with tree-style error rendering.
  • Image comparison — pixel, histogram, template-matching, and ORB feature algorithms.
  • Cross-platform screenshots — desktop, Android (ADB), iOS (xcrun), and Flutter; auto-annotated.
  • Zero-config defaults — bundled report.yaml works out-of-the-box; project-level YAML overrides automatically picked up.

Installation

pip install robotframework-xlibrary-result

Optional extras:

Extra Adds Use when
[schema] jsonschema You need VALIDATE JSON SCHEMA
[imaging] opencv-python, imageio You need template / ORB image diff
[all] All of the above You want everything bundled
pip install "robotframework-xlibrary-result[all]"

Quick Start

*** 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}

More runnable examples: see examples/.


Keyword Reference

Setup & Lifecycle

Keyword Purpose
Load Report Config Load report.yaml (project or bundled default)
Setup Generate HTML Report Initialise the report at suite start
Write Steps To HTML Flush collected steps to the final HTML at suite teardown
SET CURRENT TEST CASE ID Bind the active test case for subsequent steps

Step Logging

Keyword Purpose
APPEND STEP TO HTML RESULT Add a generic step (status badge, duration, attachments)
APPEND STEP TITLE Add a section title
APPEND STEP SUB TITLE Add a sub-section title
Capture Screenshot Capture & attach an annotated screenshot
Generate Execution Results From Steps Build the suite-level execution summary
ANALYZE REPORT ON TEST RESULT Post-run analysis of report contents

API Logging

Keyword Purpose
APPEND STEP REQUEST HTML RESULT Log a single HTTP request (headers / body / cURL)
Append Request and Response to HTML Report Log request + response side-by-side
VALIDATE RESPONSE WITH HTML Validate a response and embed the result

Data Comparison

Keyword Purpose
Compare Dict to Dict Deep-diff two dicts
Compare List of Dict to List of Dict Deep-diff two lists of dicts (per-item card view)
Compare Dict to List of Dict Match a dict against a list-of-dicts

Validation & Imaging

Keyword Purpose
VALIDATE JSON SCHEMA Validate JSON against Draft-7 schema
xCompare Images Compare two images (pixel / histogram / template / ORB)

Configuration

The library searches upwards from your test file for CONFIG/REPORT_CONFIG/report.yaml. If none is found, it falls back to the bundled defaults/report.yaml — so it works out-of-the-box with zero 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"

Full schema with comments: defaults/report.yaml.


Compatibility

Supported
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                  # run smoke tests
ruff check src tests    # lint
python -m build         # build sdist + wheel

Contributions welcome — please open an issue first to discuss significant changes. See CHANGELOG.md for release notes.


License

MIT — see LICENSE.

Copyright © 2026 Tassana Khrueawan.

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.1.tar.gz (140.0 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.1-py3-none-any.whl (145.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for robotframework_xlibrary_result-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5c10ec55252b17e30aed9bdc5743b00df0ef82f2d143fa67149b2370c0ab7975
MD5 8cc56530fa7206368a8cf6501392d158
BLAKE2b-256 6ea312e26b231aed7bfae2a3d3f3ad69fb8bd3e1f2f59d541d24ff79694465b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for robotframework_xlibrary_result-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 58b35627b8ba403d3b5d7e8c7943b89bba2ea53adb091cd8dcf668954e3cb4e1
MD5 960e13713661bf1654bba6d7c1e87868
BLAKE2b-256 e62663e1c1f173dc6e0ba5493680a853858bccc19f8e3c2769e1cbd620a87015

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