re-run failed as soon as it fails

342 views
Skip to first unread message

martino turturiello

unread,
Mar 6, 2014, 1:09:17 PM3/6/14
to robotframe...@googlegroups.com
Hi all,
I know there is already a way to re-run failed test at the end of the suite execution(Issue 1615: Support merging re-run results with Rebot),
but I would like to re-run the failed test just ofter the failure is detected.

The reason behind this is that we have a huge setup to execute before run test suites and re-run the failed tests at the end implies to re-run setup as well, which is quite expensive.

Any help?


Thanks to all the community for the great job you are doing with RobotFramework!


Laurent Bristiel

unread,
Mar 6, 2014, 2:31:49 PM3/6/14
to robotframe...@googlegroups.com
Hi,

I have the same situation.
For most of the unstable tests I am happy with the re-reun-failed-tests.
But for some tests like you, I include the re-run mechanism in the test itself.
To do so, I kind of transform the whole test (setup/teardown excluded) into a single keyword and call that with my own keyword that does several tries.
This is my "retry keyword":

Run_keyword_n_times_and_stop_if_success
    [Arguments]  ${keyword}  ${number_tries}
    :FOR  ${index}  IN RANGE  ${number_tries}
    \  ${result}  ${error_message} =  Run Keyword And Ignore Error  ${keyword}
    \  Pass Execution If  '${result}' == 'PASS'  keyword execution was successful
    # if ends up here, then the previous tries were failures
    Fail  ${error_message}

Note that there is also the "run keyword until succeeds" but it is "time-managed", whereas mine is "tries-managed"

HTH,
Laurent

martino turturiello

unread,
Mar 11, 2014, 7:21:09 PM3/11/14
to robotframe...@googlegroups.com
There is any way to to this buy using the "listener" or any other way?

We really would like to add this as framework feature rather then declare inside a test case.


Thanks for you help,
Martino

martino turturiello

unread,
Mar 25, 2014, 5:09:01 PM3/25/14
to robotframe...@googlegroups.com
Any one on this?

Cheer!
Reply all
Reply to author
Forward
0 new messages