Unit testing for speed?

Simon is thinking about using unit testing to help with performance testing. Whilst I’ve found it useful to use unit tests as very focussed ways to run a profiler on a selection of code I don’t think it’s a good idea to tie the success of your test to it completing within a particular length of time.

After all, you might decide to run all of your tests under a tool such as Boundschecker and it would be a pity to get false failures due to the fact that the test is running slower just because you’re using some other tool or running on some other machine.

Then again, I think it could be useful to display the time it took to run the test, that way you may notice that the tests are suddenly taking longer due to a design change, or whatever…

More thought needed, I think.