Setup reports from API

Class library usage, coding and language questions.
Noxxys
Posts: 7
Joined: Wed Oct 22, 2014 4:09 pm

Setup reports from API

Post by Noxxys » Fri Dec 05, 2014 4:49 pm

Hi,

In Ranorex Studio, I was able to set up the report file to my liking:

Image

However, when I write code from Visual Studio and I use the Ranorex API, it doesn't generate reports anywhere.
I've tried to use the following code, but it generates an .html file that only contains <message> tags. I would like to have the same kind of reports as in Ranorex Studio.

Code: Select all

string log_name = "RanorexKinSync_" + System.DateTime.Now.ToString("yyyyMMdd_HHmmss");
Ranorex.Report.Setup(ReportLevel.Info, log_name + @"\" + log_name + ".html", true);
Thanks in advance

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Setup reports from API

Post by Support Team » Tue Dec 09, 2014 2:46 pm

Hi Noxxys,

I found two forum posts about reporting in code, may I ask you to take a look at them?
Here are the links: Create Test Case from code Module and Ranorex reporting from Visual Studio.

To initialize the new reporting mechanism please use the TestReport.Setup() method instead of the Report.Setup() method.

If there should remain any questions unanswered please do let me know.

Regards,
Markus
.
Image

Noxxys
Posts: 7
Joined: Wed Oct 22, 2014 4:09 pm

Re: Setup reports from API

Post by Noxxys » Thu Dec 11, 2014 6:24 pm

Thanks, this is what I was looking for.

However I'm having an issue: in the resulting report file (html), my test case is empty and doesn't show the info and warning messages that should be there. I can see these messages in the .data file, but they are not loaded by the html file.

Code: Select all

TestReport.Setup(ReportLevel.Debug, report_file_path, true);
TestReport.BeginTestSuite("KinSync");
TestReport.BeginTestCase("Sync");
// a bunch of code, everything stays in the same class
Report.Info("some message");
// and at the end of each exit path of my method, I have:
TestReport.EndTestCase();
TestReport.SaveReport();
I've attached the resulting report files.

Thanks
Attachments
KinSync_20141211_181311.zip
(187.75 KiB) Downloaded 105 times