Robot Framework library for testing Robot Framework tests and tasks within Robot Framework itself.
Project description
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 Teardownfrom 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 Teardownfrom 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 Variablemay 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
Run Robot Test(orRun Robot Task) acts as a marker keyword (it does nothing by itself).- The library registers itself as a Listener v3 via
@library(listener='SELF'). - In the
start_testhook (which fires for both tests and tasks), the listener finds allRun Robot Test/Run Robot Taskmarkers. - The target
.robotfile is parsed (and cached) usingTestSuite.from_file_system(). - Resource files imported by the target suite are loaded via
Import Resource. - Variables from the target suite's
*** Variables ***section (scalar, list, and dict) are injected asSet Test Variablecalls. [Setup]and[Teardown]from the target test/task are injected as regular body steps (first and last, respectively).- Test/task body steps (including all control structures) are deep-copied and inserted.
- 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 itselftests/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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file robotframework_robotlibrary-1.0a3.tar.gz.
File metadata
- Download URL: robotframework_robotlibrary-1.0a3.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
404d061dcaa8c49b13cc0d4e3a5e402fde52227cd1f3b69f42c8019a5ce991bf
|
|
| MD5 |
01d97fc087d5a1d49b1b09709c93e206
|
|
| BLAKE2b-256 |
a84d71cc21d80a1608d4fa36d62eb8bed6e1a06ce228975d82ed785a362aa1c9
|
Provenance
The following attestation bundles were made for robotframework_robotlibrary-1.0a3.tar.gz:
Publisher:
release.yml on datakurre/robotframework-robotlibrary
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
robotframework_robotlibrary-1.0a3.tar.gz -
Subject digest:
404d061dcaa8c49b13cc0d4e3a5e402fde52227cd1f3b69f42c8019a5ce991bf - Sigstore transparency entry: 929121140
- Sigstore integration time:
-
Permalink:
datakurre/robotframework-robotlibrary@6866ab29bf6d15e1d306e9b1343667c3eb2e2a8c -
Branch / Tag:
refs/tags/v1.0a3 - Owner: https://github.com/datakurre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6866ab29bf6d15e1d306e9b1343667c3eb2e2a8c -
Trigger Event:
push
-
Statement type:
File details
Details for the file robotframework_robotlibrary-1.0a3-py3-none-any.whl.
File metadata
- Download URL: robotframework_robotlibrary-1.0a3-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e70fdd82c21983700a09df3fc114aa9979653f2b76e91f62627df2fcf2de703
|
|
| MD5 |
2088437f9b8df068219edf279a96746e
|
|
| BLAKE2b-256 |
b23ef40f69227382fdadf3ee61a35f255968a056b87f7d28e1b7089a2030e305
|
Provenance
The following attestation bundles were made for robotframework_robotlibrary-1.0a3-py3-none-any.whl:
Publisher:
release.yml on datakurre/robotframework-robotlibrary
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
robotframework_robotlibrary-1.0a3-py3-none-any.whl -
Subject digest:
0e70fdd82c21983700a09df3fc114aa9979653f2b76e91f62627df2fcf2de703 - Sigstore transparency entry: 929121142
- Sigstore integration time:
-
Permalink:
datakurre/robotframework-robotlibrary@6866ab29bf6d15e1d306e9b1343667c3eb2e2a8c -
Branch / Tag:
refs/tags/v1.0a3 - Owner: https://github.com/datakurre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6866ab29bf6d15e1d306e9b1343667c3eb2e2a8c -
Trigger Event:
push
-
Statement type: