Skip to main content

A Robot Framework Listener for library agnostic self-healing, failure triage and root cause analysis of tests

Project description

robotframework-heal

A Robot Framework listener for failure triage, self-healing and root-cause analysis of UI tests (Browser/Playwright, SeleniumLibrary and Appium).

Every failed keyword is classified into a failure class, healed when possible — and always turned into a clean, enriched error record:

Failure class What happens
locator-drift tiered: deterministic candidates → LLM picks (verified live) → full-DOM fallback; elements inside iframes heal via frame >>> inner selectors
timing waits for page-ready and reruns — no LLM
viewport scrolls (web) or swipe-searches (Appium) the element into view — no LLM
overlay dismisses the blocking dialog/banner, verifies, reruns
form-state diagnoses unfilled required / invalid fields (DOM + optional screenshot)
assertion-drift opt-in: verifies UI text drifted and reruns with the corrected expectation
unknown root-cause analysis only

📙 Full documentation — tutorials, how-to guides, the complete generated HEAL_* configuration and CLI reference, and the design/benchmarks behind it.

Install

pip install robotframework-heal            # Browser/Playwright + Appium
pip install robotframework-heal[selenium]  # + SeleniumLibrary support

Quickstart

*** Settings ***
Library    Browser    timeout=3s
Library    Heal
# .env (auto-loaded from the working dir upwards; overrides the environment)
HEAL_MODEL=openai/gpt-4.1-nano
HEAL_BASE_URL=https://openrouter.ai/api/v1
HEAL_API_KEY=sk-...
heal doctor --role locator   # verify the endpoint
robot -d results suites/     # heal during the run

Then open results/heal/heal_report.html.

Library import

Library Heal is the canonical import. These also work:

Library    heal.rf.HealListener   # fully-qualified equivalent
Library    SelfHealing            # deprecated 0.3 shim (emits a warning)

Configuration

All configuration is read from HEAL_* environment variables. The nearest .env (searched from the working directory upwards) is loaded automatically and overrides already-set environment variables. The tables below cover the common settings; the full reference is generated from the schema and lists every option.

Model (required)

Variable Default Purpose
HEAL_MODEL Model name (e.g. MiniMax-M2.5) or a pydantic-ai provider string (e.g. openai:gpt-4.1-mini)
HEAL_BASE_URL OpenAI-compatible endpoint (vLLM, Ollama, LiteLLM, MiniMax, OpenRouter, …)
HEAL_API_KEY API key for the endpoint
HEAL_OUTPUT_MODE auto Structured-output transport: auto / tool / native / prompted

Per-role overrides — each agent role can use its own backend; unset values fall back to the defaults above:

HEAL_TRIAGE_MODEL=openai/gpt-4.1-nano        # cheap/fast triage
HEAL_LOCATOR_MODEL=openai/gpt-4.1            # stronger locator healing
# also: HEAL_<ROLE>_BASE_URL / _API_KEY / _OUTPUT_MODE   (ROLE = TRIAGE|LOCATOR|VISION|RCA)

Behaviour / options

Variable Default Purpose
HEAL_ENABLED true Master switch for the healing engine
HEAL_LOCATOR_TIERS selection selection (candidates + index pick, ~70% fewer tokens) or generation (full-DOM prompt)
HEAL_FIX_TIER report Highest fix-application tier: report / patch / in-place
HEAL_WARM_START true Reuse healed locators from previous runs (history.sqlite) — repeat heals cost zero tokens
HEAL_HEAL_ASSERTIONS false Opt-in assertion-drift healing
HEAL_FORM_FILL false Opt-in form auto-fill (invents test data; diagnose-only by default)

Budgets

Variable Default Purpose
HEAL_MAX_FAILURE_SECONDS 60 Wall-clock cap per healing transaction
HEAL_MAX_FAILURE_TOKENS 50000 Token cap per transaction
HEAL_MAX_RUN_TOKENS 2000000 Token cap per run; breach degrades to RCA-only
HEAL_REQUEST_LIMIT 8 Max LLM requests per agent run within a transaction
HEAL_AGENT_RETRIES 3 Output-validator retries per agent run
HEAL_READY_TIMEOUT_SECONDS 20 Max wait for page-ready in timing recovery

Reporting

Variable Default Purpose
HEAL_REPORT_DIR <RF output dir>/heal Where artifacts are written
HEAL_HISTORY_DB <report dir>/history.sqlite Cross-run healing history (powers warm start)

What you get

After a run, the report directory contains:

  • heal_report.html — self-contained dashboard (healed and unhealed failures, evidence, costs, fix proposals)
  • events.jsonl — append-only, crash-safe run store
  • summary.json — for CI gates (e.g. fail above a heal-count threshold)
  • healed_files/ + diffs/ — read-only fixed copies and word-highlighted diffs (your suites are never modified)
  • heal.patch — git-appliable fixes (at HEAL_FIX_TIER=patch)
  • history.sqlite — cross-run memory

CLI

heal triage results/    # summarize failures, RCAs and fix proposals
heal report results/    # render dashboard + diffs
heal apply results/     # apply fixes (--patch / --in-place)
heal doctor --role all  # probe configured model endpoints
heal history db.sqlite  # repeat-healing hotspots
heal mcp results/        # MCP server for coding agents

Documentation

Development

uv sync
uv run invoke heal-utests                     # unit tests (no LLM, no browser)
uv run invoke heal-atests                     # acceptance tests (real browser, no LLM)
uv run invoke heal-atests --live-llm          # + live healing (needs HEAL_* config)
uv run --group docs mkdocs serve              # preview the docs site

License

Apache-2.0.

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_heal-0.4.0.tar.gz (638.7 kB view details)

Uploaded Source

Built Distribution

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

robotframework_heal-0.4.0-py3-none-any.whl (102.0 kB view details)

Uploaded Python 3

File details

Details for the file robotframework_heal-0.4.0.tar.gz.

File metadata

  • Download URL: robotframework_heal-0.4.0.tar.gz
  • Upload date:
  • Size: 638.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for robotframework_heal-0.4.0.tar.gz
Algorithm Hash digest
SHA256 6ae36f44f4d6a63e3a60876ad0e3eea90baba6221b217cc3615d19fcc4874b62
MD5 5fa7061430c995fe4e595b7f7e96e2e1
BLAKE2b-256 26f1dcf2ef864c87d6a8015538f271237a97aca81da18c9967e971bf6343f5af

See more details on using hashes here.

File details

Details for the file robotframework_heal-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: robotframework_heal-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 102.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for robotframework_heal-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 395adf6c2e02aa3577f817026d5d751a792cf5ae92c51592c095b27af0cbc050
MD5 023114d7903e1b9b216a50ad8ab10dbd
BLAKE2b-256 cf335d73d56295985932b1088d92e604709ca1828e36ed0488a1596c797713f6

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