Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate custom logs using rebot command?

I am executing set of test cases using robot framework as follows:

pybot -o output1.xml -l log1.html -r report1.html  testsuite.robot

this will create the output xml file along with report and log files respectively in my directory.

Now, consider there are 10 test cases in the above suite and out of which 8 are passed and 2 are failed. I will rerun these test cases using following command:

pybot --rerunfailed  -o output2.xml -l log2.html -r report2.html  testsuite.robot

I will get two xmls and then I wanted to merge them and get the final xml file as output1.xml along with new log and report files using following command:

rebot --merge output1.xml output2.xml

My concern is, here we are getting log.html and report.html. But, instead of these default files, can i get my customized logs with whatever name I give?

Like below

rebot --merge output1.xml output2.xml -l Final_Log.html -r Final_Report.html

How can I get logs with customized name after merging the two xml files?

like image 329
Humble_PrOgRaMeR Avatar asked Dec 14 '22 22:12

Humble_PrOgRaMeR


2 Answers

You don't need the --merge.

If you want to join two logs together, use this command.

rebot -N TwoCombinedTests --outputdir C:/Path/Where/You/Want/To/Save Test1.xml Test2.xml

This will combine 2 test xmls for you with the names Test1 and Test2. In the path you gave with the --outputdir option and with the final name of TwoCombinedTests thanks to the -N command.

Note; of course you will have to be in the current directoy where these xml file are being stored in. If using the terminal just a simple cd /path/to/xmls will suffice.

Edit - In my case, when I run my tests (around 6 robot files) It would generate 6 of each file (report, log output) each having their own custom name (name of the test along with the build/sprint number.) I would then throw these names into a sprint and merge them all. Here is the example of the script I use for you to understand what rebot is meant for (not over thinking what is it)

# command to combine all the reports into one large report.
os.system('rebot -N AllCombinedTests-' + SprintSlash + '-' + Build + ' '
          '--outputdir C:/AutomationLogs/' + Product + '/Combined/'
          + Version + Sprint + Build + " " + TotalXml)

Where TotalXml is a string list of all XMLs found.

Edit2:

rebot --merge --name ExampleName original.xml merged.xml

This rebot command will combine two output xmls for you (original.xml and merged.xml) with the name ExampleName

From here you will have a big "output xml" which you can then just run rebot again to generate a report/log from it

rebot -N NameThatYouWant ExampleName.xml

This will use the XML you just generated along with the name "NameThatYouWant "

Any questions please ask away.

like image 188
Goralight Avatar answered Dec 28 '22 06:12

Goralight


I got re-worked on the question. Thanks To Goralight for sparking me idea of getting customized xml,log and report files.

Lets begin.

pybot -o output1.xml -l log1.html -r report1.html testsuite.robot

pybot --rerunfailed  -o output2.xml -l log2.html -r report2.html  testsuite.robot

After this I got to merge these two xml files. I need new xml file, log file and report file respectively. So, with help of Gorlight's result and my further research i got following solution by which i am quite convinced.

rebot --merge --output Final_output.xml -l Final_log.html -r  final_report.xml output1.xml output2.xml

This gave me following three files

Final_output.xml, Final_log.html and final_report.xml

At Last this is what I wanted. No This I integrated with my Jenkins report generator and populated the final pass/fail result.

Thanks a Lot Goralight for help.

like image 38
Humble_PrOgRaMeR Avatar answered Dec 28 '22 08:12

Humble_PrOgRaMeR