Setting report folder using Code

Experiences, small talk, and other automation gossip.
Matt_The_Tester
Posts: 1
Joined: Mon Nov 26, 2018 1:24 pm

Setting report folder using Code

Post by Matt_The_Tester » Mon Nov 26, 2018 1:34 pm

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();

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 4047
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Setting report folder using Code

Post by odklizec » Tue Nov 27, 2018 8:54 am

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
report_name_path.png (19.12 KiB) Viewed 64 times
Check this user guide chapter, for more command line parameters you may find useful ;)
https://www.ranorex.com/help/latest/ran ... ex-studio/
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration