{"id":6445,"library":"robotframework-retryfailed","title":"Robot Framework RetryFailed Listener","description":"robotframework-retryfailed is a Robot Framework listener that enables automatic retrying of failed tests or tasks based on specific tags. It integrates directly with Robot Framework's execution, providing in-place retries for individual failing tests without requiring a separate re-execution command. The current version is 0.2.0, released in October 2022, and its release cadence appears infrequent.","status":"active","version":"0.2.0","language":"en","source_language":"en","source_url":"https://github.com/MarketSquare/robotframework-retryfailed","tags":["robotframework","listener","retry","automation","testing"],"install":[{"cmd":"pip install robotframework-retryfailed","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"This library is a listener for Robot Framework and requires it to function.","package":"robotframework","optional":false}],"imports":[{"note":"The library is used as a listener directly via the Robot Framework command line, not typically imported into Python code for direct instantiation.","wrong":"from robotframework_retryfailed import RetryFailed","symbol":"RetryFailed","correct":"robot --listener RetryFailed <your_suite.robot>"},{"note":"The listener accepts arguments directly after a colon, e.g., to set a global retry count or configuration options.","symbol":"RetryFailed with arguments","correct":"robot --listener RetryFailed:1 <your_suite.robot>"}],"quickstart":{"code":"import os\n\n# Create a dummy Robot Framework test file\nrobot_file_content = '''\n*** Settings ***\nLibrary    OperatingSystem\n\n*** Test Cases ***\nExample Failing Test\n    [Tags]    test:retry(2)\n    Fail If    True    This test is designed to fail and retry\n'''.strip()\n\nwith open('my_tests.robot', 'w') as f:\n    f.write(robot_file_content)\n\n# Run Robot Framework with the RetryFailed listener\n# For demonstration, we'll just print the command\n# In a real scenario, you'd run this via subprocess or directly in your shell\nrobot_command = f\"robot --listener RetryFailed:2 my_tests.robot\"\nprint(f\"To run the example, execute:\\n{robot_command}\")\n# Expected outcome: The test 'Example Failing Test' will fail, be retried twice, and ultimately still fail if 'Fail If True' is never satisfied.\n# The final report will show retries occurred.\n","lang":"python","description":"This quickstart demonstrates how to use the `robotframework-retryfailed` listener. It creates a simple Robot Framework file with a test case tagged for retries. The test is configured to fail, triggering the listener to retry it. Execute the generated `robot` command to see the retries in action."},"warnings":[{"fix":"Always use `robot --listener RetryFailed` or `robot --listener RetryFailed:<args>`.","message":"The listener is triggered via command-line arguments to `robot`, not by importing a class in a Python file. Ensure the listener name `RetryFailed` is correctly spelled and followed by a colon for arguments (e.g., `RetryFailed:2`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Understand the scope: `robotframework-retryfailed` for in-place test/task retries, `Wait Until Keyword Succeeds` for keyword retries, `--rerunfailed` for re-running a subset of tests from a previous `output.xml`.","message":"Users often confuse this listener with Robot Framework's built-in `Wait Until Keyword Succeeds` keyword (for individual keywords) or the `--rerunfailed` command-line option (for re-executing failed tests from a previous run). `robotframework-retryfailed` offers in-place retries for entire tests or tasks during a single execution run.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review GitHub issues for updates and consider testing thoroughly if `exitonfailure` is used alongside `robotframework-retryfailed`.","message":"There are open issues regarding potential conflicts with Robot Framework's `exitonfailure` option, which might cause unexpected behavior when combined with `robotframework-retryfailed`.","severity":"gotcha","affected_versions":"0.2.0 (and potentially earlier)"},{"fix":"Be aware that setup failures might not trigger retries. Test any 'Setup' retry expectations. Monitor GitHub issues for fixes or workarounds regarding unintended double execution.","message":"An open issue on GitHub reports that the listener might not retry 'Setup' sections (Suite Setup or Test Setup), only the test body itself. Also, issues exist where the first test case in a file might run twice, even if it passes.","severity":"gotcha","affected_versions":"0.2.0 (and potentially earlier)"},{"fix":"Refer to the GitHub `CHANGELOG.md` (if available) or the issue tracker for significant changes, and test new versions thoroughly.","message":"The project's GitHub repository currently shows no explicit 'Releases' section, despite the package being available on PyPI. This can make tracking structured release notes or breaking changes between versions difficult.","severity":"breaking","affected_versions":"All versions (0.2.0 onwards)"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}