Hi Guys, does anyone know how to run the test again just once if it fails?

Hi Guys, does anyone know how to run the test again just once if it fails?

Edit: See @René 's answer below for a newer/better way to do this.

We do this internally with a bat or sh file:

bat:

//Run your robot command:
robot file.robot

//Check if any tests failed, if so we rerun the failures and combine the reports:
IF NOT %ERRORLEVEL%==0 (robot --rerunfailed output.xml --output rerun.xml  file.robot & rebot --ProcessEmptySuite --output output.xml --merge output.xml rerun.xml)

sh:

//Run your robot command:
robot file.robot
//Check if any tests failed, if so we rerun the failures and combine the reports:
if [ $? -gt 0 ]
    then
       robot --rerunfailed output.xml --output rerun.xml  file.robot
       rebot --ProcessEmptySuite --output output.xml --merge output.xml rerun.xml
fi
2 Likes

@René recently created a reserved tag for this I believe…can’t find the details right now though, but I believe you can configure it at test level and set how many times a give test case should be retried.

1 Like

This listener retries single tests directly after they failed.

No need to run robot twice

2 Likes