Page 1 of 1

Set recorded report paths for Ranorex

Posted: Thu Dec 04, 2014 5:31 pm
by swainpabitra
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

Re: Set recorded report paths for Ranorex

Posted: Fri Dec 05, 2014 11:07 am
by Support Team
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

Re: Set recorded report paths for Ranorex

Posted: Fri Dec 05, 2014 3:23 pm
by krstcs
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.

Re: Set recorded report paths for Ranorex

Posted: Mon Dec 15, 2014 3:11 pm
by swainpabitra
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. :)

Re: Set recorded report paths for Ranorex

Posted: Tue Dec 16, 2014 12:26 pm
by Support Team
Hello Pabitra,

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

Regards,
Robert