Brandon
Brandon

Reputation: 14196

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?

Upvotes: 1

Views: 623

Answers (2)

Lucas B
Lucas B

Reputation: 12013

You could use NUnit, it has the Pass utility which allows you to record a message in the test result for instances like this.

Upvotes: 1

Nader Shirazie
Nader Shirazie

Reputation: 10776

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...

Upvotes: 1

Related Questions