Unit tests are powerful. They can provide great value; or if misused, considerable harm. Here are 10 examples of often misunderstood corners of unit testing likely to appear in your projects, so you can analyze how unit tests can be helpful or go wrong. 1. Tests that help with discovery One of my favorite qualities of extensive unit tests is that surprises can come soon after a mistake. While working recently on an arithmetic algorithm, an error message in a completely unrelated content management part of the application went bad. It turned out that a week earlier, someone else had manipulated a string result in-place, where a deep copy would have been more appropriate. What a relief to discover the confusion when I did! If I’d only tested the numeric results in the vicinity of my new implementation, the missing deep copy might have stayed hidden for a few weeks more, at which point it would have been considerably harder to diagnose what the rea...