Hi, there,
Is there a function in Ranorex to report the current system timetamp?
Report.Info("There is a failure at", timestampfunction);
any function to report current system time in Ranorex
Re: any function to report current system time in Ranorex
You can write your own...
Code: Select all
string strYear = System.DateTime.Now.Year.ToString();
string strMonth = System.DateTime.Now.Month.ToString();
string strDay = System.DateTime.Now.Day.ToString();
string strHour = System.DateTime.Now.Hour.ToString();
string strMinute = System.DateTime.Now.Minute.ToString();
string strSecond = System.DateTime.Now.Second.ToString();
string strDateTimeStamp = strYear + "_" + strMonth + "_" + strDay + "___" + strHour + "_" + strMinute + "_" + strSecond;
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: any function to report current system time in Ranorex
And it can get even easier, since the System.DateTime class already defines some nice overloads for the ToString() method, see http://msdn.microsoft.com/en-us/library ... tinfo.aspx
Regards,
Alex
Ranorex Support Team
Report.Info("The current time is " + System.DateTime.Now.ToString("U"));Moreover, the standard Ranorex XML and console loggers already print the time that the message was logged at.
Regards,
Alex
Ranorex Support Team
Re: any function to report current system time in Ranorex
You are correct about the "easier" way to do it. The reason I broke it out the way I did is so I can manipulate the different parts of the sate and time to name my report file in a standard fashion that was requested of me. Basically "Time_Date_logname.xml".
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: any function to report current system time in Ranorex
Alex, thanks for the link it is very helpful to manipulate the date/time format
Ceige, your function has better control of the format. By the way, how do you generate xml format report and how to control the content in that report?
Ceige, your function has better control of the format. By the way, how do you generate xml format report and how to control the content in that report?
Re: any function to report current system time in Ranorex
For the report, I use Report.Setup and pass it an XML name. That way when the report is created it is immediately viewable by anyone with the XSL available within IE.
I store my report XML & XSL in a networked directory so that others on my team (QA & Dev) have access to the reports.
The code below is what I use to create a report on the local drive that has a date/time stamped parent folder. Once the testing is complete I will move the folder to the network location that we have picked to store automation results.
I store my report XML & XSL in a networked directory so that others on my team (QA & Dev) have access to the reports.
The code below is what I use to create a report on the local drive that has a date/time stamped parent folder. Once the testing is complete I will move the folder to the network location that we have picked to store automation results.
Code: Select all
// Setup Reporter
string strYear = System.DateTime.Now.Year.ToString();
string strMonth = System.DateTime.Now.Month.ToString();
string strDay = System.DateTime.Now.Day.ToString();
string strHour = System.DateTime.Now.Hour.ToString();
string strMinute = System.DateTime.Now.Minute.ToString();
string strSecond = System.DateTime.Now.Second.ToString();
string strDateTimeStamp = strYear + "_" + strMonth + "_" + strDay + "___" + strHour + "_" + strMinute + "_" + strSecond;
string LogFile = @"c:\temp\Report\" + strDateTimeStamp + @"\Package_Price_Quote_Reg_Test.xml";
if (Directory.Exists(@"c:\temp\Report\" + strDateTimeStamp) == false)
{
Directory.CreateDirectory(@"c:\temp\Report\" + strDateTimeStamp);
}
Report.Setup(ReportLevel.Debug, LogFile, true);
Report.SystemSummary();
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: any function to report current system time in Ranorex
Ceige, thank you so much for the code example. That works.
BTW, I benefit a lot from the functions you sent to me earlier, those are really good stuff!
BTW, I benefit a lot from the functions you sent to me earlier, those are really good stuff!
Last edited by lingzhou on Fri Aug 21, 2009 7:20 pm, edited 1 time in total.
Re: any function to report current system time in Ranorex
You are very welcome. Glad I could help.
Is there any functionality that you find missing in the Excel methods I sent you? I have only written methods for what I use but that is obviously not all that it can do.
Is there any functionality that you find missing in the Excel methods I sent you? I have only written methods for what I use but that is obviously not all that it can do.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: any function to report current system time in Ranorex
I am mainly using two functions now. If I need more functions later on, I will try to change the code by myself and share it with you, or looking for help from you

Ciege wrote:You are very welcome. Glad I could help.
Is there any functionality that you find missing in the Excel methods I sent you? I have only written methods for what I use but that is obviously not all that it can do.