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