Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

RobotLibrary

[!WARNING] This project is primarily developed with the assistance of AI coding agents. See CONTRIBUTING.md for details.

A Robot Framework library for testing Robot Framework tests and tasks within Robot Framework itself — without subprocess execution.

Overview

RobotLibrary enables meta-testing: you write Robot Framework tests that exercise other .robot test/task files. The target suite's steps are injected into the calling test at runtime using the Listener v3 API, so everything runs in a single process with clean logs.

Key features:

  • No subprocess execution — tests run in the same Python process.
  • Control structures — FOR, IF, WHILE, TRY/EXCEPT, BREAK, CONTINUE all work.
  • Test setup/teardown — [Setup] and [Teardown] from target tests are injected.
  • Suite-level fixtures — default Test Setup / Test Teardown from target *** Settings *** are honoured.
  • Resource imports — resource files imported by the target suite are auto-imported at runtime.
  • Variable override — suite variables (scalar, list, and dict) can be overridden per test.
  • Clean logs — injected steps appear directly in the test body.
  • Works with both tests and tasks.

Important limitations:

  • Early development — many Robot Framework edge cases are not yet handled.
  • No library imports — only Resource imports from the target suite are handled; Library imports are not.
  • No suite setup/teardown — Suite Setup / Suite Teardown from target files are ignored (only test-level fixtures are injected).
  • Setup/teardown semantics — target [Setup] and [Teardown] are injected as regular body steps, so they lack the special RF semantics (e.g. teardown always running on failure).
  • Advanced variable scoping — complex variable expressions or scoping beyond Set Test Variable may not work.

Installation

pip install robotframework-robotlibrary

Or install from source for development:

pip install -e .

Quick Start

Given a target test suite (login.robot):

*** Variables ***
${USERNAME}    default_user
${PASSWORD}    default_pass

*** Test Cases ***
Login Test
    Log    Logging in as ${USERNAME}
    Should Not Be Empty    ${USERNAME}
    Should Not Be Empty    ${PASSWORD}

Write a meta-test suite (test_login.robot):

*** Settings ***
Library    RobotLibrary

*** Test Cases ***
Test Login With Defaults
    Run Robot Test    ${CURDIR}/login.robot    Login Test

Test Login With Custom Credentials
    Run Robot Test    ${CURDIR}/login.robot    Login Test
    ...    USERNAME=admin
    ...    PASSWORD=secret

Run the meta-tests:

robot test_login.robot

Keyword Documentation

Run Robot Test

Run Robot Test    suite_path    test_name    **variables
Argument Description
suite_path Path to the .robot file (absolute, or relative to current suite).
test_name Name of the test case or task to run.
**variables Variable overrides as NAME=value pairs.

The keyword also works with Test Template for data-driven testing:

*** Settings ***
Library          RobotLibrary
Test Template    Run task

*** Keywords ***
Run task
    [Arguments]    ${NAME}
    Run Robot Test    ${CURDIR}/tasks.robot    Log name    NAME=${NAME}

*** Test Cases ***    NAME
Log John              John
Log Jane              Jane

Run Robot Task

Run Robot Task    suite_path    task_name    **variables

An alias for Run Robot Test designed for RPA task suites (files using *** Tasks *** instead of *** Test Cases ***). It works identically — the target task's steps are injected into the calling test or task at runtime.

Argument Description
suite_path Path to the .robot file containing tasks.
task_name Name of the task to run.
**variables Variable overrides as NAME=value pairs.
*** Settings ***
Library    RobotLibrary

*** Test Cases ***
Test Invoice Processing
    Run Robot Task    ${CURDIR}/process.robot    Process Invoice
    ...    SOURCE=invoices.csv

The keyword also works with Task Template in task suites:

*** Settings ***
Library          RobotLibrary
Task Template    Run Robot Task

*** Tasks ***                  SUITE_PATH                    TASK_NAME      NAME
Process John                   ${CURDIR}/tasks.robot         Log name       John
Process Jane                   ${CURDIR}/tasks.robot         Log name       Jane

How It Works

  1. Run Robot Test (or Run Robot Task) acts as a marker keyword (it does nothing by itself).
  2. The library registers itself as a Listener v3 via @library(listener='SELF').
  3. In the start_test hook (which fires for both tests and tasks), the listener finds all Run Robot Test / Run Robot Task markers.
  4. The target .robot file is parsed (and cached) using TestSuite.from_file_system().
  5. Resource files imported by the target suite are loaded via Import Resource.
  6. Variables from the target suite's *** Variables *** section (scalar, list, and dict) are injected as Set Test Variable calls.
  7. [Setup] and [Teardown] from the target test/task are injected as regular body steps (first and last, respectively).
  8. Test/task body steps (including all control structures) are deep-copied and inserted.
  9. The marker keyword is removed — logs show only the injected steps.

Task support: Target suites can use either *** Test Cases *** or *** Tasks ***. The Robot Framework model treats both uniformly, so all features (variable injection, control structures, setup/teardown, Task Setup/Task Teardown from the Settings section) work transparently.

Note: This is a proof-of-concept implementation. The step injection mechanism has been tested with control structures (FOR, WHILE, IF, TRY/EXCEPT, BREAK, CONTINUE), setup/teardown, resource imports, and complex variable types, but has not been tested with custom libraries with state, nested suite hierarchies, or advanced variable scoping.

Development

# Install in editable mode
pip install -e .

# Run acceptance tests (meta-tests)
make test

# Generate keyword documentation
make libdoc

# Clean build artifacts
make clean

Test Organization

The repository includes comprehensive meta-tests that verify RobotLibrary's injection mechanism:

  • tests/ — Meta-tests that test RobotLibrary itself
  • tests/examples/ — Example test suites that serve as injection targets

See tests/README.md and tests/examples/README.md for details on the test organization and examples of testable test patterns.

License

Apache License 2.0 — see LICENSE for details.

Metadata

Release files for robotframework-robotlibrary 1.0a3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-robotlibrary 1.0a3
File Size Uploaded
robotframework_robotlibrary-1.0a3.tar.gz 18.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-robotlibrary 1.0a3
File Interpreter ABI Platform
robotframework_robotlibrary-1.0a3-py3-none-any.whl Python 3 none any Details

Total release size: 34.0 kB

Release files / robotframework_robotlibrary-1.0a3.tar.gz

Download URL robotframework_robotlibrary-1.0a3.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
404d061dcaa8c49b13cc0d4e3a5e402fde52227cd1f3b69f42c8019a5ce991bf
BLAKE2b-256 checksum
How to use checksums
a84d71cc21d80a1608d4fa36d62eb8bed6e1a06ce228975d82ed785a362aa1c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 8, 2026.

Transparency log

Release files / robotframework_robotlibrary-1.0a3-py3-none-any.whl

Download URL robotframework_robotlibrary-1.0a3-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e70fdd82c21983700a09df3fc114aa9979653f2b76e91f62627df2fcf2de703
BLAKE2b-256 checksum
How to use checksums
b23ef40f69227382fdadf3ee61a35f255968a056b87f7d28e1b7089a2030e305
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 8, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page