I have the following Selenium test:
[TestMethod]
public void Edit()
{
Driver.GoToAdministrera();
Driver.ClickLink(strings.ActorSettings);
Driver.SendKeysToId(text, "Attributes");
Driver.Navigate().Refresh();
Driver.AssertTextInId(string.Empty, "Attributes");
Driver.SendKeysToId(text, "Attributes");
Driver.ClickClass("submitbutton");
Thread.Sleep(3000);
Driver.Navigate().Refresh();
Driver.AssertTextInId(text, "Attributes");
}
It is slow and I want to analyze where the bottleneck is. I know I could profile the test, but that will give me some long stack-trace and hotspots. I just want to know how long the execution time is for each row.
I know I can use the StopWatch class. I can even do something like a help method for this:
protected static void Time(Action action)
{
var sw = new Stopwatch();
sw.Reset();
sw.Start();
action();
sw.Stop();
Console.WriteLine(sw.Elapsed + " " + action.Method.Name);
}
But this requires me to modify my test.
Does anyone know of a method to get the timings for each row in a piece of code executed?