Robot Framework RetryFailed Listener

0.2.0 · active · verified Wed Apr 15

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.

Warnings

Install

Imports

Quickstart

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.

import os

# Create a dummy Robot Framework test file
robot_file_content = '''
*** Settings ***
Library    OperatingSystem

*** Test Cases ***
Example Failing Test
    [Tags]    test:retry(2)
    Fail If    True    This test is designed to fail and retry
'''.strip()

with open('my_tests.robot', 'w') as f:
    f.write(robot_file_content)

# Run Robot Framework with the RetryFailed listener
# For demonstration, we'll just print the command
# In a real scenario, you'd run this via subprocess or directly in your shell
robot_command = f"robot --listener RetryFailed:2 my_tests.robot"
print(f"To run the example, execute:\n{robot_command}")
# Expected outcome: The test 'Example Failing Test' will fail, be retried twice, and ultimately still fail if 'Fail If True' is never satisfied.
# The final report will show retries occurred.

view raw JSON →