{"id":2265,"library":"robotframework","title":"Robot Framework","description":"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.","status":"active","version":"7.4.2","language":"python","source_language":"en","source_url":"https://github.com/robotframework/robotframework","tags":["testing","automation","rpa","bdd","acceptance-testing","keyword-driven"],"install":[{"cmd":"pip install robotframework","lang":"bash","label":"Install core framework"}],"dependencies":[],"imports":[{"note":"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.","wrong":"import robot; robot.main()","symbol":"robot.run","correct":"from robot import run"},{"note":"The `keyword` decorator for creating custom Python keywords resides specifically in `robot.api.deco`.","wrong":"from robot.api import keyword","symbol":"keyword","correct":"from robot.api.deco import keyword"},{"note":"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`.","wrong":"from robot.builtins import BuiltIn","symbol":"BuiltIn","correct":"from robot.libraries.BuiltIn import BuiltIn"}],"quickstart":{"code":"import os\nimport tempfile\nfrom pathlib import Path\nfrom robot import run\n\n# Create a temporary .robot test file\nrobot_content = '''\n*** Settings ***\nLibrary    OperatingSystem\n\n*** Test Cases ***\nMy First Robot Test\n    Log To Console    Hello from Robot Framework!\n    Create File    ${TEMPDIR}${/}robot_test.txt    This is a test file.\n    File Should Exist    ${TEMPDIR}${/}robot_test.txt\n    Remove File    ${TEMPDIR}${/}robot_test.txt\n'''\n\nwith tempfile.TemporaryDirectory() as tmpdir:\n    test_file_path = Path(tmpdir) / 'my_test.robot'\n    test_file_path.write_text(robot_content)\n\n    print(f\"Running Robot Framework test from: {test_file_path}\")\n    # Execute the test programmatically\n    # Setting loglevel to DEBUG for verbose output, can be omitted\n    result = run(test_file_path.as_posix(), loglevel='INFO', outputdir=tmpdir)\n\n    if result == 0:\n        print(\"Robot Framework test ran successfully!\")\n    else:\n        print(f\"Robot Framework test failed with exit code: {result}\")\n\n    print(f\"Output and logs can be found in: {tmpdir}\")\n","lang":"python","description":"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`."},"warnings":[{"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.","message":"Robot 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.","severity":"breaking","affected_versions":">=4.0"},{"fix":"Migrate to the external `robotframework-testdoc` tool. Install it via `pip install robotframework-testdoc` and use it instead of the built-in version.","message":"The built-in `Testdoc` tool has been deprecated in Robot Framework 7.4.2 in favor of the external `robotframework-testdoc` tool.","severity":"deprecated","affected_versions":">=7.4.2"},{"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.","message":"Robot 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.","severity":"gotcha","affected_versions":"all"},{"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`.","message":"When 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.","severity":"gotcha","affected_versions":"all"},{"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.","message":"Robot Framework's variable scoping (scalar, list, dictionary, global, suite, test) can be complex and lead to unexpected behavior if not understood.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'7.3':61 '7.4':53,60 '7.4.2':72 'accept':14,16,78 'acceptance-test':77 'activ':45 'allow':34 'approach':33 'atdd':21 'autom':11,25,74 'bdd':76 'bug':49 'case':41 'current':69 'develop':20 'driven':19,32,82 'e.g':52,59 'easi':37 'easy-to-read':36 'featur':57 'fix':50 'framework':2,4,12 'frequent':48 'generic':7 'keyword':31,81 'keyword-driven':30,80 'maintain':46 'open':9 'open-sourc':8 'process':24 'project':43 'read':39 'releas':51,58 'robot':1,3,23 'rpa':26,75 'seri':55 'sourc':10 'test':15,18,40,73,79 'test-driven':17 'time':65 'typic':62 'use':28 'version':70 'x':54 'year':67","created_at":"2026-04-09T18:50:34.808364+00:00","updated_at":"2026-04-16T21:04:30.500321+00:00","problems":[{"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.","cause":"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.","error":"No keyword with name '...' found."},{"fix":"Install the missing library using pip: `pip install robotframework-seleniumlibrary` (replace with the correct library name).","cause":"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.","error":"ModuleNotFoundError: No module named 'robotframework-seleniumlibrary'"},{"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.","cause":"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.","error":"'robot' is not recognized as an internal or external command, operable program or batch file."},{"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.","cause":"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.","error":"Variable '${my_variable}' not found."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"7.4.2","cli_name":"robot","cli_version":"Robot Framework 7.4.2 (Python 3.11.15 on linux)","type":"library","homepage":"https://robotframework.org","github":"https://github.com/robotframework/robotframework","docs":"https://robotframework.org/robotframework","changelog":"https://github.com/robotframework/robotframework/blob/master/doc/releasenotes/rf-7.4.2.rst","pypi":"https://pypi.org/project/robotframework/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}