Multiple folks have asked in forums on how to log a message from a Coded UI Test for tracing\debugging purpose. I know of as many as 5 ways of doing this from any test type (Coded UI Test, Unit Test etc). Try this code out -
2: public void CodedUITestMethod1()
If you check the test result window, you should see output like -
So clearly all 5 ways are working i.e. corresponding messages are getting logged. Each of these ways have their own advantages and disadvantages -
In short, use TestContext.WriteLine wherever possible.