Page 1 of 1

Ranorex reporting from Visual Studio

Posted: Wed Jan 25, 2012 12:48 pm
by anzacthecat
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?

Re: Ranorex reporting from Visual Studio

Posted: Wed Jan 25, 2012 4:27 pm
by Ciege
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.");

Re: Ranorex reporting from Visual Studio

Posted: Fri Jan 27, 2012 10:51 am
by anzacthecat
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?

Re: Ranorex reporting from Visual Studio

Posted: Fri Jan 27, 2012 11:31 am
by anzacthecat
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();

Re: Ranorex reporting from Visual Studio

Posted: Mon Mar 05, 2012 9:03 am
by artur_gadomski
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.