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:

rt-robot --killbackend

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.2.tar.gz (24.8 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.2-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for robotframework_realtimeresults-0.3.2.tar.gz
Algorithm Hash digest
SHA256 8082f2ba6297241803deedfde758f0d2a8b0e97722bbd17470373f6c6dd39c53
MD5 7fb3c65eccc57602ea531efeb4b23b80
BLAKE2b-256 e5a48f806e4db5f7ffa8856549ee8a2066eac804653bf46b2c093e04b862ee58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for robotframework_realtimeresults-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 09568b7e1812e405599459a9f13f0821e7d959b6f65a135ec775c9ba205ecee6
MD5 a873fd760ecdcda58e4e71e737548753
BLAKE2b-256 0d95e50f7e7dee84b9fe7a35e05bdd8508c268492988bc6192a78eea90931b6d

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