I am running Visual Studio 2013 Ultimate and can't get TestContext.BeginTimer("TimerName"); and TestContext.EndTimer("TimerName"); to write to the Output window of a CodedUI Test.
This post has a good solution to the issue.
I want to log the duration for groups of test steps.
First I tried writing a logger class and sending the duration to a text file.
This way seems easier to me:
1. Open the Coded UI Test .cs file and add a using statement for System.Diagnostics;
2. Create new instance of Stopwatch and give it some name (Timer in the example), add Timer.Start(); and Timer.Stop(); statements around actions that you're logging duration of, then add statement to write to test output TestContext.WriteLine("Description: " + SomeName.Elapsed.ToString());
3. Reset the timer next time and you can reuse it:
5. The output window will also show debug trace messages if EqtTraceLevel is set to 4 in QTAgent32.exe.config. TestContext messages are below the Debug Trace messages.