Ranorex reporting from Visual Studio

Class library usage, coding and language questions.
anzacthecat
Posts: 31
Joined: Mon Jan 10, 2011 1:05 pm

Ranorex reporting from Visual Studio

Post by anzacthecat » Wed Jan 25, 2012 12:48 pm

I am using Visual Studio to access the Ranorex API and my tests are running fine, but how do I use the Ranorex reporting tools?

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Ranorex reporting from Visual Studio

Post by Ciege » Wed Jan 25, 2012 4:27 pm

First you need to setup the report with something like this:

Code: Select all

Report.Setup(ReportLevel.Debug, LogFile, true);
If you also want to have the popup screen to appear about current test step while the testing is running you need to use something like the following:

Code: Select all

Ranorex.Core.Reporting.TestReport.Setup(ReportLevel.None, strTempReportDirectory + strDateTimeStamp + @"\" + "_DELETEME" + @"\_tempTestReport.rxlog", false);
Ranorex.Core.Reporting.TestReport.EnableTracingScreenshots = false;
Ranorex.Core.Reporting.TestReport.ReportWriteInterval = 0;
Ranorex.Controls.ProgressForm.Show();
Then, from your tests you can send info to the report using:

Code: Select all

Report.Success("Message.");
Report.Error("Message.");
Report.Failure("Message.");
Report.Debug("Message.");
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

anzacthecat
Posts: 31
Joined: Mon Jan 10, 2011 1:05 pm

Re: Ranorex reporting from Visual Studio

Post by anzacthecat » Fri Jan 27, 2012 10:51 am

Before I saw this I got it more or less working using something like:

TestReport.Setup(ReportLevel.Debug, "report.rxlog", true);
TestReport.BeginTestSuite("Testsuite");
TestReport.BeginTestModule("Testmodule");
TestReport.BeginTestCase("Testcase");
Report.info("Something to log");
TestReport.EndTestCase();
TestReport.EndTestModule();
TestReport.SaveReport();

This uses the new report functionality fine and puts in the titles of the testcase and testmodule but it's not adding the actual information, the "Something to log" bit. Am I missing something?

anzacthecat
Posts: 31
Joined: Mon Jan 10, 2011 1:05 pm

Re: Ranorex reporting from Visual Studio

Post by anzacthecat » Fri Jan 27, 2012 11:31 am

Whoops, the answer is that Case and Module were the wrong way round. It should be:

TestReport.Setup(ReportLevel.Debug, "report.rxlog", true);
TestReport.BeginTestSuite("Testsuite");
TestReport.BeginTestCase("Testcase");
TestReport.BeginTestModule("Testmodule");

Report.info("Something to log");

TestReport.EndTestModule();
TestReport.EndTestCase();
TestReport.SaveReport();

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Ranorex reporting from Visual Studio

Post by artur_gadomski » Mon Mar 05, 2012 9:03 am

You got it. Important to remeber about the new style is that you only see messages if they are in TestModule and that you need to close Module /Case before starting new ones.