Re: Calculate time between steps in a recording
Posted: 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.
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.