How to implement rerun on failed Robot Framework test cases in jenkins

Viewed 1435

I have test cases that I wrote using robot framework and selenium. When the build fails, I want to rerun the failed test cases only. Thus, I tried this script

robot --output output.xml tests.robot ||
robot --rerunfailed output.xml --output output2.xml tests.robot ||
rebot --output output.xml --merge output.xml output2.xml

with a conditional step (single) in jenkins. However, I get

'robot' is not recognized as an internal or external command, operable program or batch file.

when I specify the script to execute as Windows batch command. I also tried to run it as Shell Script, but that also throws an exception. Where should I specify this script and what is the name (type) of this command to use to run it in jenkins?

1 Answers

If the Robot Framework plugin is installed correctly in Jenkins then try to run it as a shell script-

sh 'robot --output output.xml tests.robot || robot --rerunfailed output.xml --output output2.xml tests.robot || rebot --output output.xml --merge output.xml output2.xml'
Related