Registry / testing / robotframework

robotframework

JSON →
library7.4.2pypypi✓ verified 26d 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.

pip install robotframework
INSTALL
IMPORT
SIG · ROBOTFRAMEWORK
R
robotframework
testingpythonv7.4.2
Install
2.0s avg
Import
631ms
Disk
22MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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.95 runs
installs and imports cleanly · install 0.0s · import 0.650s · 23.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.0s · import 0.612s · 24MB
22MB installed
● package 22MB
Code
Verified usage

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

robot.run
from robot import run
import robot; robot.main()
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.
keyword
from robot.api.deco import keyword
from robot.api import keyword
The `keyword` decorator for creating custom Python keywords resides specifically in `robot.api.deco`.
BuiltIn
from robot.libraries.BuiltIn import BuiltIn
from robot.builtins import BuiltIn
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`.

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 issues
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.
fix
Update `FOR` loops in `.robot` files by removing the leading colon. Ensure your environment uses Python 3.8 or newer. Consult release notes for other changes.
affects: >=4.0
deprecatedThe built-in `Testdoc` tool has been deprecated in Robot Framework 7.4.2 in favor of the external `robotframework-testdoc` tool.
fix
Migrate to the external `robotframework-testdoc` tool. Install it via `pip install robotframework-testdoc` and use it instead of the built-in version.
affects: >=7.4.2
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.
fix
Embrace the keyword-driven syntax for test cases. Use Python primarily for creating custom keywords (libraries) or for programmatic execution/reporting, rather than writing entire test cases in Python scripts.
affects: all
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.
fix
Use `set PYTHONPATH=<path/to/my/libraries>` before running tests, or specify the library path directly in the `.robot` file using `Library    ./my_libraries/MyLibrary.py`.
affects: all
gotchaRobot Framework's variable scoping (scalar, list, dictionary, global, suite, test) can be complex and lead to unexpected behavior if not understood.
fix
Familiarize yourself with the 'Variables' section of the Robot Framework User Guide. Use `Log Variables` keyword for debugging variable states and explicitly define variable scopes when necessary.
affects: all
Errors
Common errors & fixes
No keyword with name '...' found.
A keyword is called in a test case or resource file but the library defining it is not imported, or the keyword name is misspelled.
fix
Ensure the correct library (e.g., `SeleniumLibrary` for browser automation) is imported in the test suite settings or resource file, or correct the keyword name if it's misspelled.
ModuleNotFoundError: No module named 'robotframework-seleniumlibrary'
A required Python library for Robot Framework (such as an external library like SeleniumLibrary) is not installed in the Python environment where Robot Framework is being executed.
fix
Install the missing library using pip: `pip install robotframework-seleniumlibrary` (replace with the correct library name).
'robot' is not recognized as an internal or external command, operable program or batch file.
The Python Scripts directory (where Robot Framework's `robot` executable is located) is not included in the system's PATH environment variable, or Robot Framework was not installed correctly.
fix
Add the Python Scripts directory (e.g., `C:\Python39\Scripts` on Windows or `~/.local/bin` on Linux/macOS for user installs) to your system's PATH environment variable, or reinstall Robot Framework.
Variable '${my_variable}' not found.
A variable is used in a test case or keyword but has not been defined, is out of its current scope, or its name is misspelled.
fix
Define the variable in the appropriate scope (e.g., Variables section, Test Setup, Suite Setup) or correct the variable name to match an existing one.
Upgrade
Version history
7.4.2latest on PyPI · released Mar 3, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
robotframework — pip install robotframework · libregistry