The Laws of Unit Testing

Reading this post from Michael Puleio’s blog I got to this post from Michael Feathers’ blog. In his post Michael Feathers doesn’t state what a unit test is, but what a unit test isn’t. And, sometimes, this is just enough to help a lot.

A test is not a unit test if:

  • It talks to the database
  • It communicates across the network
  • It touches the file system
  • It can’t run at the same time as any of your other unit tests
  • You have to do special things to your environment (such as editing config files) to run it.