Tuesday, September 05, 2006

Speed of Unit Test

I have heard more than once from people saying that their unit tests are long because they have thousands, or tens of thousands of them.

Some would blame it on the complicated application architecture, or the language (like Java).

But if these guys can use a script language to run 132 tests, 219 assertions in just over half a second, maybe there is something to the idea of faster tests after all.

I am not saying it is easy, just that it is a goal worth pushing for.

2 comments:

Anonymous said...

Unit tests should always be cpu-bound only. Any more than the tiniest amount of IO will cripple test run times. I've worked on projects with over 2000 unit tests that ran in about 30-60 seconds.

Anonymous said...

I've heard the rule of thumb that if a test touches the disk, a database, or the network, it shouldn't be a unit test.