Calculate time between steps in a recording

Ranorex Spy, Recorder, and Studio.
gowthamp
Posts: 16
Joined: Fri Feb 05, 2016 7:19 pm

Re: Calculate time between steps in a recording

Post by gowthamp » Fri Apr 01, 2016 5:19 pm

Can I add MODULE GROUP name while writing to text file?

I am using the following code to generate and load content to text file.

public System.DateTime startTime()
{
timeBefore = System.DateTime.Now;
Report.Info("Content Generation Started on "+timeBefore+".");
return timeBefore;
}

public void endTime()
{
System.DateTime timeAfter = System.DateTime.Now;
TimeSpan duration = timeAfter- timeBefore; //Time taken to generate content

string s = duration.Minutes.ToString()+" Minutes:"+duration.Seconds.ToString()+" Seconds."+duration.Milliseconds.ToString()+" Milliseconds"; //convert to minutes, seconds and milliseconds
Report.Log(ReportLevel.Info,"Time taken to Generate Content:"+ duration.Minutes.ToString()+" Minutes:"+duration.Seconds.ToString()+" Seconds."+duration.Milliseconds.ToString()+" Milliseconds");

System.IO.File.AppendAllText(@"C:\Users\###\Documents\test.txt","TestCase:"+TestCase.Current.Name+" -- Time taken to Generate Content: "+s+ Environment.NewLine); //Append test case name, time
}

I want to include MODULEGROUP name after test case while writing to text file.

I tried "string moduleGroup = TestSuiteModuleGroup.Current.Name;" but it is getting module name rather than MODULE GROUP name.

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

Re: Calculate time between steps in a recording

Post by odklizec » Mon Apr 04, 2016 7:36 am

Hi,

I believe you can obtain the name of current testmodulegroup by this code:

Code: Select all

Ranorex.Core.Reporting.TestReport.CurrentTestModuleGroupActivity.ModuleGroupName
PS: please next time, create a new topic instead of reopening an old and not completely related topic. Thanks! ;)
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

gowthamp
Posts: 16
Joined: Fri Feb 05, 2016 7:19 pm

Re: Calculate time between steps in a recording

Post by gowthamp » Mon Apr 04, 2016 2:41 pm

Thanks odklizec, It helped and I am able to get moduleGroupName in text file.

This thread is related to time between steps, so I thought it is related to calculating time between module groups.