Convert Ranorex Report to PDF

Class library usage, coding and language questions.
saravanan_palanivel
Posts: 4
Joined: Wed Oct 25, 2017 2:26 pm

Convert Ranorex Report to PDF

Post by saravanan_palanivel » Wed Oct 25, 2017 2:45 pm

Hi Team,

We are using Ranorex 7.2 libraries to write test cases through Visual Studio 2015. We are successful so far in implementing use case for our Java Swing application :)

Query : We are trying to convert our test case execution result report (*.rxlog) into PDF format, so that everyone in our team can read them without having Ranorex Report Viewer installed. To accomplish this we did write following code snippet,
// Stop Report
Report.End();

var reportFileDirectory = TestReport.ReportEnvironment.ReportFileDirectory;
var ReportName = TestReport.ReportEnvironment.ReportName;

var rxlogFile = String.Format(@"{0}\{1}.rxlog", reportFileDirectory, ReportName);
var rxzlogFile = String.Format(@"{0}\{1}.rxzlog", reportFileDirectory, ReportName);
var PDFReportFilePath = String.Format(@"{0}\{1}.pdf", reportFileDirectory, ReportName);

TestReport.SaveReport();

// Create rxzlog file
Report.Zip(rxlogFile, reportFileDirectory, ReportName);

// Create PDF file
Creator.CreatePDF(rxzlogFile, PDFReportFilePath, "", "all");
Problem :
But above wasn't successful, and what we are getting from above code is below,
Ranorex.Core.FastXml.XmlDocException : Element 'activity' does not exist in element 'activity'.
06:11:16 at Ranorex.Core.FastXml.XmlNode.Child(String name)
06:11:16 at Ranorex.PDF.PDFCreator.CreateHeader(XmlNode rootActivity)
06:11:16 at Ranorex.PDF.PDFCreator..ctor(XmlNode rootNode, String xml, RanorexGraphics rg)
06:11:16 at Ranorex.PDF.Program.Main(String[] args)
06:11:16 at Ranorex.PDF.Creator.CreatePDF(String input, String output, String xml, String details)


Note : When i try the above same code with Test Suite in Ranorex Studio, its working as expected - meaning it is generating pdf of test results.
But in our case, we are using nunit to run our tests and we do not have any Test Suite kind of stuff.

Could someone please guide me on how to resolve this issue and help me to generate pdf of our test case execution results

Many thanks in advance!

- Saravanan

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Convert Ranorex Report to PDF

Post by krstcs » Wed Oct 25, 2017 7:20 pm

The Ranorex report is an HTML file. If you change the names of the report file and the data file to the following, they can be read by any browser (for IE "Allow local files" must be turned on).

Report.rxlog => Report.html
Report.rxlog.data => Report.html.data
Shortcuts usually aren't...

saravanan_palanivel
Posts: 4
Joined: Wed Oct 25, 2017 2:26 pm

Re: Convert Ranorex Report to PDF

Post by saravanan_palanivel » Thu Oct 26, 2017 10:55 am

Thank you! its solved my problem :)

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Convert Ranorex Report to PDF

Post by krstcs » Thu Oct 26, 2017 3:34 pm

So, I should add that if you need PDF, it should work using Ranorex's helper, but I'm not on 7.2, so I can't help with that part yet.

I'm glad you were able to use what I pointed out though! You're very welcome!
Shortcuts usually aren't...

reach2shrikant
Posts: 1
Joined: Wed Apr 04, 2018 9:15 pm

Re: Convert Ranorex Report to PDF

Post by reach2shrikant » Thu Apr 19, 2018 12:42 am

Where should we add this code?