xmljenkinsmergerobotframeworkqtestlib

Robot framework: How to merge two xunit xml report files?


1.My robot file after running generates 4 files basically. output.xml, xunit.xml,report.html and log.html 2. After rerun,I want to merge the rerun generated report files with the old ones and obtain a new file. later,Xunit xmls are used to update qtest testcases.

I am not able to merge Xunit xmls using "--merge" command

Error:

[ ERROR ] Reading XML source '../../../xunit.xml' failed: Incompatible XML element 'testsuite'. Please help in resolving this issue


Solution

  • You need to first merge the output xml files and then create an xunit file out of those.

    To achieve this there is a tool called rebot that is installed alongside with Robot Framework. After you have run your Robot Framework tests and have multiple different output.xml files you may run the following command:

    Let's assume you have output1.xml and output2.xml.

    rebot -R --xunit mergedxunit.xml output*.xml
    

    Running that command will create a new mergedxunit.xml file containing all the test cases run in both output1.xml and output2.xml in xunit format. Note that if you remove the -R flag, new output tests will replace identical tests in the combined file.

    Here is the rebot.py code file including information about all the different accepted parameters: https://github.com/robotframework/robotframework/blob/master/src/robot/rebot.py