- Before writing new production code (TDD)
- Before fixing a bug (exposing the bug with the test)
- In order to get to know an API where the documenation doesn't help much
- When encountering untested yet critical code (e.g. using a coverage tool)
- In case you are bored and have nothing else to do ;-)
When to write a unit test?
In my opinion the following are situations to implement another unit test.
Posted by testdrivenguy at 4:24 PM