Traits of Unit Tests

| Comments

A while back Michael Feathers wrote a short post about optimizing unit tests. In it he gives a list traits that prevent something from being a true unit test.

When trying to convert non-testers, I often use a reverse version of Michael’s list to help explain what is a unit test. So here’s the same list with a positive spin:

A test is a unit test if :

  • It doesn’t talk to the database
  • It doesn’t communicates across the network
  • It doesn’t touch the file system
  • It can be run at the same time as any of your other unit tests
  • You don’t have to do special things to your environment (such as editing config files) to run it.
Of course there are more qualities. Think of this as a list of traits as necessary but not sufficient for something to be a unit test.

blog comments powered by Disqus

About this Entry

This page contains a single entry by Aaron Oliver published on June 16, 2008 12:05 AM.

I'm Cool. Honest. Here's my Wordle was the previous entry in this blog.

Self-Discipline is the Best Weapon Against Information Overload is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Categories

Creative Commons License
This blog is licensed under a Creative Commons License.