{"id":9458,"library":"allure-robotframework","title":"Allure Robot Framework","description":"Allure Robot Framework integration provides a listener for Robot Framework that automatically collects test results and converts them into Allure's intermediate JSON format. This allows for generating rich, interactive test reports with detailed information on test execution. The current version is 2.15.3, and it follows the release cadence of the broader allure-python project, which is generally active with frequent updates.","status":"active","version":"2.15.3","language":"en","source_language":"en","source_url":"https://github.com/allure-framework/allure-python","tags":["testing","robot-framework","test-reporting","allure"],"install":[{"cmd":"pip install allure-robotframework","lang":"bash","label":"Install library"},{"cmd":"npm install -g allure-commandline # or brew install allure on macOS","lang":"bash","label":"Install Allure CLI (required for reports)"}],"dependencies":[{"reason":"Core dependency for all Allure Python integrations.","package":"allure-python-commons","optional":false},{"reason":"The core test automation framework that this library integrates with.","package":"robotframework","optional":false}],"imports":[{"note":"Used within Robot Framework keyword libraries for programmatic Allure steps.","symbol":"step","correct":"from allure_robotframework.library_api import step"},{"note":"Used within Robot Framework keyword libraries for programmatic Allure attachments.","symbol":"attach","correct":"from allure_robotframework.library_api import attach"}],"quickstart":{"code":"import os\nimport subprocess\n\n# 1. Create a dummy Robot Framework test file\nrobot_file_content = \"\"\"\n*** Settings ***\nLibrary    OperatingSystem\nLibrary    allure_robotframework.library_api\n\n*** Test Cases ***\nSimple Allure Robot Test\n    Log To Console    Starting Allure Robot Test\n    allure_robotframework.library_api.step    This is an Allure step\n    Create File    test_attachment.txt    Some attachment content\n    allure_robotframework.library_api.attach    test_attachment.txt\n    Log To Console    Test completed!\n\"\"\"\nrobot_file_path = \"example.robot\"\nwith open(robot_file_path, 'w') as f:\n    f.write(robot_file_content)\nprint(f\"Created {robot_file_path}\")\n\n# 2. Run Robot Framework tests with the Allure listener\nprint(\"\\n--- Running Robot Framework tests ---\")\n# This command executes Robot Framework, using allure-robotframework as a listener.\n# It generates raw Allure results in the 'allure-results' directory.\ntry:\n    subprocess.run(\n        [\"robot\", \"--listener\", \"allure_robotframework\", robot_file_path],\n        check=True,\n        capture_output=True,\n        text=True\n    )\n    print(\"Robot Framework tests executed successfully. Allure results generated in 'allure-results'.\")\nexcept subprocess.CalledProcessError as e:\n    print(f\"Error running Robot Framework tests: {e}\")\n    print(f\"Stdout:\\n{e.stdout}\")\n    print(f\"Stderr:\\n{e.stderr}\")\n    print(\"Please ensure 'robotframework' and 'allure-robotframework' are installed.\")\n    exit(1)\nexcept FileNotFoundError:\n    print(\"Error: 'robot' command not found. Please install Robot Framework.\")\n    exit(1)\n\n# 3. Generate the Allure report\nprint(\"\\n--- Generating Allure report ---\")\n# This command processes the raw results and creates a human-readable HTML report.\n# It requires the 'allure-commandline' tool to be installed.\nreport_dir = \"allure-report\"\ntry:\n    subprocess.run(\n        [\"allure\", \"generate\", \"allure-results\", \"-o\", report_dir, \"--clean\"],\n        check=True,\n        capture_output=True,\n        text=True\n    )\n    print(f\"Allure report generated successfully in '{report_dir}'.\")\n    print(f\"To view the report, open '{os.path.abspath(report_dir)}/index.html' in your browser, or run 'allure open {report_dir}'.\")\nexcept FileNotFoundError:\n    print(\"\\nError: 'allure' command not found.\")\n    print(\"Please install the Allure command-line tool. See https://docs.qameta.io/allure/#_install_a_commandline for instructions.\")\n    exit(1)\nexcept subprocess.CalledProcessError as e:\n    print(f\"Error generating Allure report: {e}\")\n    print(f\"Stdout:\\n{e.stdout}\")\n    print(f\"Stderr:\\n{e.stderr}\")\n    exit(1)\n\n# Optional cleanup:\n# os.remove(robot_file_path)\n# os.remove(\"test_attachment.txt\")\n# import shutil\n# shutil.rmtree(\"allure-results\", ignore_errors=True)\n# shutil.rmtree(report_dir, ignore_errors=True)\n","lang":"python","description":"This quickstart demonstrates the full lifecycle: creating a minimal Robot Framework test, executing it with the Allure listener to generate raw results, and then processing those results into an interactive HTML report using the Allure command-line tool. Ensure `robotframework`, `allure-robotframework`, and `allure-commandline` are installed."},"warnings":[{"fix":"Install the Allure command-line tool separately. For example: `npm install -g allure-commandline` (Node.js required) or `brew install allure` (macOS).","message":"The Allure command-line tool (`allure`) is not automatically installed with `allure-robotframework`. It is crucial for generating the final HTML report from the raw JSON results.","severity":"gotcha","affected_versions":"All versions"},{"fix":"After running tests, execute `allure generate allure-results -o allure-report --clean` (replace `allure-report` with your desired output directory).","message":"The `allure-results` directory contains raw JSON data from test execution, not the human-readable report. These files must be processed by the Allure command-line tool to create the final HTML report.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always use the exact listener name: `robot --listener allure_robotframework your_tests.robot`.","message":"When running Robot Framework, ensure the Allure listener is correctly specified with `--listener allure_robotframework`. Typos or incorrect capitalization will prevent results from being collected.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always use a compatible version. Refer to the `allure-python` GitHub page for current compatibility with Robot Framework versions. Upgrade `allure-robotframework` to the latest stable release for best compatibility.","message":"Older versions of `allure-robotframework` might not be compatible with newer versions of Robot Framework (e.g., Robot Framework 4.0 removed deprecated APIs which could break older listeners).","severity":"breaking","affected_versions":"<2.12.0 with RF 4.0+"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Install the Allure command-line tool globally. Example: `npm install -g allure-commandline`.","cause":"The `allure` command-line tool is not installed or not in your system's PATH.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'allure'"},{"fix":"Install the package: `pip install allure-robotframework`.","cause":"The `allure-robotframework` Python package is not installed in your active Python environment.","error":"ModuleNotFoundError: No module named 'allure_robotframework'"},{"fix":"Ensure `pip install allure-robotframework` has been run and verify the correct spelling: `robot --listener allure_robotframework your_tests.robot`.","cause":"This error occurs during Robot Framework execution if `allure-robotframework` is not installed, or if there's a typo in the listener name, or if the package is installed in a different Python environment than the one running Robot Framework.","error":"Listener 'allure_robotframework' does not exist."},{"fix":"Confirm that `allure-robotframework` is installed and accessible to your Robot Framework environment. Ensure the casing is correct: `Library    allure_robotframework.library_api`.","cause":"When using `Library    allure_robotframework.library_api` in your Robot file, this indicates that the library API cannot be found by Robot Framework.","error":"[ ERROR ] Parsing 'your_keywords.robot' failed: File or directory to import does not exist. (allure_robotframework.library_api)"}]}