Registry / testing / robotframework

robotframework

JSON →
library7.4.2pypypi✓ verified 35d ago

Robot Framework is a generic open-source automation framework for acceptance testing, acceptance test-driven development (ATDD), and robotic process automation (RPA). It uses a keyword-driven approach, allowing for easy-to-read test cases. The project is actively maintained with frequent bug fix releases (e.g., 7.4.x series) and feature releases (e.g., 7.4, 7.3) typically a few times a year. The current version is 7.4.2.

testingdevops
Install & Compatibility
Where this runs
tested against v7.4.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.925 runs
installs and imports cleanly · install 0.0s · import 0.670s · 23.8MB
glibc
py 3.103.925 runs
installs and imports cleanly · install 1.9s · import 0.657s · 24MB
22MB installed
● package 22MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

The `robot.run` function is the standard programmatic entry point for executing Robot Framework tests from Python. `robot.main()` is an older, less flexible approach.

from robot import run

The `keyword` decorator for creating custom Python keywords resides specifically in `robot.api.deco`.

from robot.api.deco import keyword

To access Robot Framework's built-in keywords (e.g., Log, Should Be Equal) from a custom Python library, import `BuiltIn` from `robot.libraries.BuiltIn`.

from robot.libraries.BuiltIn import BuiltIn

This quickstart demonstrates how to programmatically run a Robot Framework test from a Python script. It creates a simple `.robot` file on the fly and then uses `robot.run` to execute it. This is useful for integrating Robot Framework into CI/CD pipelines or other automation scripts. Standard usage often involves running tests directly from the command line using `robot path/to/tests.robot`.

import os import tempfile from pathlib import Path from robot import run # Create a temporary .robot test file robot_content = ''' *** Settings *** Library OperatingSystem *** Test Cases *** My First Robot Test Log To Console Hello from Robot Framework! Create File ${TEMPDIR}${/}robot_test.txt This is a test file. File Should Exist ${TEMPDIR}${/}robot_test.txt Remove File ${TEMPDIR}${/}robot_test.txt ''' with tempfile.TemporaryDirectory() as tmpdir: test_file_path = Path(tmpdir) / 'my_test.robot' test_file_path.write_text(robot_content) print(f"Running Robot Framework test from: {test_file_path}") # Execute the test programmatically # Setting loglevel to DEBUG for verbose output, can be omitted result = run(test_file_path.as_posix(), loglevel='INFO', outputdir=tmpdir) if result == 0: print("Robot Framework test ran successfully!") else: print(f"Robot Framework test failed with exit code: {result}") print(f"Output and logs can be found in: {tmpdir}")
robot --version
Debug
Known footguns
breakingRobot Framework 4.0 introduced significant breaking changes, notably the 'FOR' loop syntax changed from `:FOR` to `FOR`, and Python 2 support was completely dropped. All Robot Framework 4.x and newer versions require Python 3.
deprecatedThe built-in `Testdoc` tool has been deprecated in Robot Framework 7.4.2 in favor of the external `robotframework-testdoc` tool.
gotchaRobot Framework is primarily driven by its domain-specific language (DSL) in `.robot` files and executed via a command-line interface. It's not a 'pure Python' testing framework like `pytest` or `unittest`. While it has a Python API for extension (custom libraries, listeners), most test logic resides in `.robot` files.
gotchaWhen creating custom Python libraries for Robot Framework, their modules must be discoverable. This often means ensuring they are in the `PYTHONPATH` or placed directly under the test suite directory.
gotchaRobot Framework's variable scoping (scalar, list, dictionary, global, suite, test) can be complex and lead to unexpected behavior if not understood.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
10 hits · last 30 days
gptbot
4
ahrefsbot
4
bytedance
2
Resources