Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
87 views
in Technique[技术] by (71.8m points)

c# - Add custom message to unit test result

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.

question from:https://stackoverflow.com/questions/4589912/add-custom-message-to-unit-test-result

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...