Page 1 of 1

Setting report folder using Code

Posted: Mon Nov 26, 2018 1:34 pm
by Matt_The_Tester
Hi Guys, this was my solution for this problem. I am sure it can be optimized and am always open to healthy criticism :P :mrgreen: :lol:

Problem :
I didn't want to set the report location using Ranorex as this will become problematic because i will need to explain every time someone installing the application.

Solution :
Set the location in the Code so that they just need to pull my project from a Repo and no further configuration needed.

''Code'' **I added my code in the 'SETUP' container

string filename = TestSuite.CurrentTestContainer.Name +" " + System.DateTime.Now.ToString("dd-MM-yyyy_hh-mm-ss");
System.IO.Directory.CreateDirectory(@"C:\Temp\Reports\"+ filename);
TestReport.Setup(ReportLevel.Debug,@"C:\Temp\Reports\" + filename + @"\myreport.rxlog",true); //Report saving code
TestReport.SaveReport();
TestReport.EndTestContainerSetup();

Re: Setting report folder using Code

Posted: Tue Nov 27, 2018 8:54 am
by odklizec
Hi,

Thanks for the code. Unless I'm missing something, you can achieve the same by using simple /reportfile command line parameter and some date/time variables, so no code is required...
report_name_path.png
Check this user guide chapter, for more command line parameters you may find useful ;)
https://www.ranorex.com/help/latest/ran ... ex-studio/