senram
senram

Reputation: 51

robotframework : How to ignore failure from --rerunfailed when all tests are passed

I run my robotframework test suite as a teamcity/jenkins build with two simple steps as below

When all the tests in step-1 are passed, the build fails because step-2 (--rerunfailed) triggers an error ( [ ERROR ] Collecting failed tests from 'Results\output.xml' failed: All tests passed.) .

Could someone please suggest how to ignore or overcome this error, so that I can show the build as passed in this case ?

Upvotes: 5

Views: 2685

Answers (3)

Anastasia Solomina
Anastasia Solomina

Reputation: 1

There's robot:skip-on-failure tag. It it sets then a test case will skip for failure and perform if it's ok. It takes RobotFramework 5.0.

Upvotes: 0

Yogesh Rathod
Yogesh Rathod

Reputation: 31

I had similar Problem, i fixed it this way:

robot -d %ResultPath% %TestSuitName% || robot --rerunfailed output.xml --output output1.xml -l log.html -r report.html TestSuitName || rebot --rerunmerge --output output.xml -l log.html -r report.html output.xml output1.xml

Uses || to run those command simultaneously and it will work.

Upvotes: 3

Bryan Oakley
Bryan Oakley

Reputation: 385980

Make build step #2 dependent on build step #1 failing. That is, only run pybot --rerunfailed if the first pybot exited with a non-zero exit status.

The simplest way to do this is to create a custom test runner in bash or python or powershell that does both the running of pybot and re-running of pybot as a single step. You then configure this shell script as a single step.

Another way to do it is to have your second build step either look at the return code of the previous step (if possible), or scans the output.xml to see if there are failures. If there are no failures, it returns without doing any work.

Upvotes: 2

Related Questions