Skip to main content

Realtime Robot Framework listener with FastAPI backend and Loki integration.

Project description

Robotframework-RealtimeResults

Robotframework-RealtimeResults is a modular, extensible system for collecting, processing, and visualizing test results, application logs, and metrics in real time. It is designed for use with Robot Framework but also supports ingestion application logs and custom metrics. The system is suitable for both local development and CI/CD pipelines.


Features

  • Realtime Dashboard: Live web dashboard for monitoring Robot Framework test runs, application logs, and metrics.
  • Automatic Service Management: CLI automatically starts backend APIs and log tailers as needed.
  • Multi-source Log Ingestion: Tail and ingest logs from multiple sources/files, each with its own label and timezone.
  • Metric Tracking: Ingest and store custom metrics alongside logs and test events. (todo)
  • Flexible Storage: Supports SQLite (file or in-memory); Loki integration (planned).
  • Pluggable Sinks: Easily extend with new sinks (e.g., HTTP, Loki, custom).
  • Configurable via Wizard: Interactive setup wizard for easy configuration.
  • REST API: FastAPI-based endpoints for event ingestion and dashboard queries.
  • Extensible: Modular codebase for adding new readers, sinks, or event types.

Architecture Overview

[ Robot Framework Run ]
        │
        │
        ├──► Listener writes to (SQLite / FastApi Ingest) ──►  Event Store 
        │                                                      ▲  │
        │                                                      │  │
        └─────► [ Log Tailer(s) (FastApi Ingest) ] ────────────┘  │
                                                                  │
                                                       Reads from │ (or writes in case of in-memory mode)
                                                                  ▼
                                                        [ FastAPI Viewer ]
                                                                  │
                                                        Serves data to Dashboard
                                                                  ▼
                                                          [ Dashboard UI ]

Components

1. Robot Framework Listener

  • Captures test events (suite/test start/end, log messages) in real time.
  • Sends events to a configured sink (SQLite, HTTP API, or Loki).
  • Supports unique test IDs, timestamps, tags, and more.
  • See producers/listener/listener.py.

2. Log Tailer

  • Tails one or more application log files and sends parsed log lines to the ingest API.
  • Supports per-source configuration (label, event type, timezone, poll interval).
  • Parses timestamps, log levels, and message content using robust regex patterns.
  • See producers/log_producer/log_tails.py.

3. Metric Ingestion (todo)

  • Supports ingestion of custom metrics (name, value, unit, source).
  • Metrics are stored in the same event store and can be visualized or queried.
  • See shared/sinks/sqlite_async.py.

4. Backend APIs

  • Viewer API: Serves dashboard, test events, and application logs.
  • Ingest API: Receives logs and metrics via POST.

5. Dashboard

  • Live web dashboard (HTML + JS) for real-time visualization.
  • Displays test status, failures, elapsed time, and live application logs.
  • Accessible at /dashboard on the viewer backend.
  • See dashboard/index.html.

6. Sinks

  • SQLite Sink: Persistent storage for test events and logs.
  • Async SQLite Sink: Async variant for log/metric ingestion.
  • Memory Sink: In-memory storage for ephemeral runs.
  • HTTP Sink: For sending events to remote APIs.
  • Loki Sink: (Planned) Integration with Grafana Loki for log aggregation.
  • All sinks inherit from shared/sinks/base.py.

Installation

From PyPI

pip install robotframework-realtimeresults

From Source

git clone https://github.com/alebr001/robotframework-realtimeresults
cd robotframework-realtimeresults
pip install poetry
poetry install
poetry run rt-robot tests/

CLI Usage

Run your Robot Framework tests with real-time results:

rt-robot tests/
  • The CLI will auto-start backend services and log tailers but it is preferable to start manually.
  • If no config file is found, an interactive setup wizard will guide you.

Prefered usage

  • Terminal 1: rt-robot --runservice api.viewer.main:app --config path/to/custom_config.json
  • Terminal 2: rt-robot --runservice api.ingest.main:app --config path/to/custom_config.json
  • Terminal 3: python producers/log_producer/log_tails.py

Custom Config Path

rt-robot --config path/to/custom_config.json tests/

Stopping Services

When services are started via CLI, and rt-robot is used, backend PIDs are stored in backend.pid. Stop them with:

python kill_backend.py

Configuration

If no config file is found, the CLI launches a wizard. Example config:

{
  "backend_strategy": "sqlite",
  "listener_sink_type": "sqlite",
  "sqlite_path": "eventlog.db",
  "viewer_backend_host": "127.0.0.1",
  "viewer_backend_port": 8000,
  "ingest_backend_host": "127.0.0.1",
  "ingest_backend_port": 8001,
  "source_log_tails": [
    {
      "path": "../logs/app.log",
      "label": "app",
      "poll_interval": 1.0,
      "event_type": "app_log",
      "log_level": "INFO",
      "tz_info": "Europe/Amsterdam"
    }
  ],
  "log_level": "INFO"
}
  • source_log_tails: List of log files to tail, each with its own label, event type, poll interval, and timezone.
  • listener_sink_type: Choose between sqlite, backend_http_inmemory, or loki (planned).
  • ingest_sink_type: For the ingest API, typically asyncsqlite.

REST API Endpoints

Viewer API

  • GET /events — List all test events.
  • GET /applog — List all application logs.
  • GET /events/clear — Clear all test events.
  • GET /dashboard — Dashboard UI.

Ingest API

  • POST /log — Ingest application log or metric (JSON payload).
  • POST /event — Ingest test event (sync, for legacy use).

Dashboard

Open http://127.0.0.1:8000/dashboard to view:

  • Live test status (PASS/FAIL/SKIP)
  • Failure details
  • Suite execution time
  • Live application logs

Extending Functionality


Project Structure

.
├── api/
│   ├── ingest/         # Log + metric ingestion API
│   └── viewer/         # Dashboard and query API
├── dashboard/          # Static frontend dashboard
├── producers/
│   ├── listener/       # Robot Framework listener
│   └── log_producer/   # Tail logfiles and send to backend
├── shared/
│   └── helpers/        # Config loader, setup wizard, logging, parsing
│   └── sinks/          # http (sync/async), sqlite (sync/async/memory), loki (planned)
├── cli.py              # CLI entrypoint
└── pyproject.toml

Requirements

  • Python 3.9 or later (tested on 3.9 – 3.13)
  • Works on macOS, Linux, Windows

Planned Features

  • Grafana Loki integration for log aggregation.
  • Advanced dashboard filtering and tag support.
  • Metric visualization.
  • Optional authentication for APIs.

License

MIT — use and modify freely.


Contributing

Contributions are welcome! Please open issues or pull requests on

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_realtimeresults-0.3.1.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

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

robotframework_realtimeresults-0.3.1-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file robotframework_realtimeresults-0.3.1.tar.gz.

File metadata

File hashes

Hashes for robotframework_realtimeresults-0.3.1.tar.gz
Algorithm Hash digest
SHA256 5957e47600f198f3589a8fca8eac4fabc6edfda7dbabc61ca8f2229ffa6a767e
MD5 787691b6c4efe6730f723d2923d1edc3
BLAKE2b-256 f1d356f35f862c87f5280e207cdd4c5c710a46444750c70aea8931f235efcd84

See more details on using hashes here.

File details

Details for the file robotframework_realtimeresults-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for robotframework_realtimeresults-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ba38ddefcd02d664b95e87dd9ca4fc245743812b583f28a3d6094d20bdf05a7
MD5 3931a61aa86e51f5e7d495b78d12e4c4
BLAKE2b-256 b8c786dfbe6831b931456e675408082642cd6ed5452208471152662ff05a69b2

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