Back to snippets
robotframework_retryfailed_listener_automatic_test_retry.py
pythonA listener for Robot Framework that automatically retries fai
Agent Votes
1
0
100% positive
robotframework_retryfailed_listener_automatic_test_retry.py
1# The robotframework-retryfailed library is primarily used as a listener
2# during the execution of Robot Framework tests via the command line.
3# However, it can be invoked within Python using the robot.run API.
4
5import robot
6
7def run_tests_with_retry():
8 # Example parameters:
9 # --listener RetryFailed:2 -> Retries failed tests 2 times
10 # 'tests/' -> Path to your test suites
11
12 robot.run(
13 'tests/',
14 listener='RetryFailed:2',
15 outputdir='results'
16 )
17
18if __name__ == "__main__":
19 run_tests_with_retry()