Is there a way I can add a custom message to the result of a test method? I want to put a stopwatch on part of the code to see how long its running. I don't need to test that it's running within a certain time frame, just want to see in the result window what the elapsed time was.
Assuming you are using MSTest, you can use
System.Diagnostics.Trace.WriteLine("Hello World");
To output whatever you'd like. It will show up in the full results of the test runner.
2.1m questions
2.1m answers
60 comments
57.0k users