Getting the time to execute a step as a variable

Class library usage, coding and language questions.
Lightning
Posts: 4
Joined: Mon Jan 14, 2013 2:31 pm

Getting the time to execute a step as a variable

Post by Lightning » Tue Apr 30, 2013 5:02 pm

Hi,

I was just curious if there is a way of getting the time associated with a step as it appears in the log file, I want to store this as a variable within Ranorex.

Image

Danke!

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Getting the time to execute a step as a variable

Post by Support Team » Thu May 02, 2013 3:09 pm

Hello,

Unfortunately, this time is calculated after your test and stored in your report.
Therefore, you couldn't get this value in a common way.

I recommend you to measure the elapsed time of your action between start and end.
Please take a look at the code snippet below:
System.DateTime timeBefore = System.DateTime.Now;
// do your action
System.DateTime timeAfter = System.DateTime.Now;
Report.Info("Time: " + (timeAfter - timeBefore));
Regards,
Markus (T)
.
Image