Since I just spent the last couple of hours detangling some legacy unit tests, I felt this was worth noting...
Unit tests should never depend on the actions of another unit test! They should be independent of each other and able to be run in isolation. For example, a database delete-test should not depend on the preceding insert-test to have completed successfully. And when running data-access unit tests, use a tool such as NDbUnit to put the test database into a known state both before and after the tests are run.
With that said, it was nice to find tangled unit tests there rather than no tests at all!
03-29-2007 4:03 PM