Set recorded report paths for Ranorex

Ask general questions here.
swainpabitra
Posts: 13
Joined: Thu Dec 04, 2014 5:21 pm

Set recorded report paths for Ranorex

Post by swainpabitra » Thu Dec 04, 2014 5:31 pm

Hi,
I am new in Ranorex.
I recorded several test cases for a desktop application.
Some reports are in success and some are gets error report.Both are ok in their test cases.
But my question is that, how can i set different report path for error reports and success report?
such that if error report occurs then report will move to error folder, if success report occurs then report will move to success folder.

Thanx,
Pabitra Swain

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Set recorded report paths for Ranorex

Post by Support Team » Fri Dec 05, 2014 11:07 am

Hello Pabitra,

I’m afraid that there is not out-of-the-box solution for moving reports to specific folders based on their result.
In general, you could use the the “int error” which is specified within the Program.cs file in order to check whether the test has failed or succeeded (0 = Success, -1 = Failure).

For example:

Program.cs : Code added just before "return error"
using System.IO;
string successFolder = @"c:\success";
string failureFolder = @"c:\failure";
	
	if (!Directory.Exists(successFolder))
	{
		Directory.CreateDirectory(successFolder);
	}
	if (!Directory.Exists(failureFolder))
	{
		Directory.CreateDirectory(failureFolder);
	}
	
string reportLocation = Directory.GetCurrentDirectory();
string reportFilename = TestReport.ReportEnvironment.ReportName;

string sourceReportFilename = String.Format(@"{0}\{1}.rxzlog", reportLocation, reportFilename);
	
	if(error == 0)
	{
		string destinationReportFilename = String.Format(@"{0}\{1}.rxzlog",successFolder, reportFilename);
		File.Copy(sourceReportFilename, destinationReportFilename);
			
	}
	else
	{
		string destinationReportFilename = String.Format(@"{0}\{1}.rxzlog",failureFolder, reportFilename);
		File.Copy(sourceReportFilename, destinationReportFilename);
	}
Please note that this sample requires a compressed report file. Further information on how to enable the compressed report can be found here: TestSuiteSettings

Regards,
Robert

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

Re: Set recorded report paths for Ranorex

Post by krstcs » Fri Dec 05, 2014 3:23 pm

Since Ranorex returns a 0 (Success) or -1 (Failed) when the test ends, you could use a batch file to run the test and then, based on the result returned back to the OS, you could move the report to the correct folder.
Shortcuts usually aren't...

swainpabitra
Posts: 13
Joined: Thu Dec 04, 2014 5:21 pm

Re: Set recorded report paths for Ranorex

Post by swainpabitra » Mon Dec 15, 2014 3:11 pm

Hello Support Team,
Yes, its worked for me.Thanks for your support.
Actually only report movement is not enough for proper view, so i had also transfered all files and all image folders for proper view of report. And its works nice.
Once again thanks. :)

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Set recorded report paths for Ranorex

Post by Support Team » Tue Dec 16, 2014 12:26 pm

Hello Pabitra,

I'm glad that we could help you in this matter.

Regards,
Robert