What should we Unit Test
Unit tests should be done wisely (Note: I suggest reading my previous post about Mocks before this one) It is easy to fall into the unit test biggest pitfall - dumb unit tests. What is the recipe for a popular unit-test pitfall ? Assume unit tests are very important Test everything verify every method call Get 100% coverage Yes, the above is bad. The most obvious problem you will find yourself struggling with will be failing tests regularily, and changing the tests to pass those failure points. That is the direct opposite target we want to achieve from unit tests. Upgrading of a unit test happens, but it shouldn't happen too much unless you specifically changed code in order to change the business logic. When a test fails, it should point to a problem with the code not with the test. Why do we fall to this pitfall ? Because we: Create unfocused unit tests We test all the easy things instead of testing the important things We te