Introduction
Nowadays robot framework is getting used across inside many projects and testing domain i.e. UI testing (Selenium) , API testing ,DB testing, mobile testing(Appium) etc.
If you are curious or new to robot framework you can refer here https://automationlab0000.wordpress.com/2018/09/14/why-to-use-robot-framework/
Robot framework generates readable html reports after the complete execution of suites (collection of test cases). These reports will have
- output.xml
- log.html
- report.html
output.xml is mother of all the information which are captured during test execution’s, these contains many important information’s e.g.
1. Status of test cases
2. Status of keywords
3. Time taken for each TC\KWs and many more important information.
Apart from this, robot framework also provides rich cli options , one of the most used option is –rerunfailed
Why we need to rerun failed cases ?
In many suites, particularly in UI, there could be many error due to latentcy or intermmittent issue so if the pass count is less then 80% its problematic to share with the others when we know that failures are due to intermittent issues.
In those scenarios the best approach is to rerun the failed cases again.
How to run failed cases again
Lets start with code then , we have two test cases which can fail randomly
*** Settings ***
Library String
*** Variables ***
*** Test Cases ***
verify odd number
[Documentation] This test case will fail if the number comes as odd number
${odd_number} Generate Random Number
${Boolean} Evaluate ${odd_number}%2 == 0
run keyword if ${Boolean} log to console odd number ELSE Fail
verify even number
[Documentation] This test case will fail if the number comes as odd number
Generate Random Number
${even_number} Generate Random Number
${Boolean} Evaluate ${even_number}%2 == 0
run keyword if ${Boolean} log to console even number
*** Keywords ***
Generate Random Number
${PO_Number} Generate random string 1 0123456789
[Return] ${PO_Number}
lets run the test with command
robot Odd_Even_Test.robot

Robot framework generates one output.xml and 2 HTML file i.e. log.html , report.html. This output.xml is responsible for generation of these two html file and contains all the information related to executed automation code.

We will be using those information to get the list of failed cases and running them again using –rerunfailed options
robot --rerunfailed "output.xml" --output "rerun.xml" suite.robot

How to merge old and new xml
once the execution gets completed, you have the old ‘Output.xml” and new “rerun.xml” the next step would be to merge them so that you get a consolidated output using rebot command
rebot –merge output.xml rerun.xml

Here is the combined xml
