VS2008 Unit Tests: How to include a message with a "success"
Using Visual Studio 2008 for a unit test, one of the unit tests has to do with a basic performance smoke test to make sure additional code doesn't slow down a heavily-used method too badly.
Obviously, I want this to fail when the "# per 开发者_开发知识库second" falls below a certain value, and of course it displays my message in the Error Message column, but when it passes, I'd still like this performance metric displayed somewhere in the Unit Test results.
Is this possible?
You could just print the value to standard output (Console.WriteLine
). It is very low tech, but standard output is usually captured.
Of course, it all depends on how you display your Unit Test Results. Most of the time results are just Red/Green, with error details shown...
You could use NUnit, it has the Pass utility which allows you to record a message in the test result for instances like this.
精彩评论