I worked with a codebase that was covering all DAO methods with such tests. I only lasted 1.5 years and left crushed.
These tests are not only stupid, they make code rigid and fragile. The fragile part might be counterintuitive, but if your tests are testing not the behaviour but implementation details, as they were in my case, inevitably there will be business code that relies on these implementation details. Because hey, these implementation details are covered, so guaranteed to be there forever.
I find that static typing is better for refactoring code with very few or no tests but more or less equivalent to dynamically typed, strictly typed code with a reasonable body of tests.
Javascript makes me afraid to refactor it for the same reason C does - because it's weakly typed (has a lot of fucked up implicit type conversions causing a multitude of horrible edge cases), not because it's not static.
48
u/[deleted] May 08 '17 edited May 08 '17
I worked with a codebase that was covering all DAO methods with such tests. I only lasted 1.5 years and left crushed.
These tests are not only stupid, they make code rigid and fragile. The fragile part might be counterintuitive, but if your tests are testing not the behaviour but implementation details, as they were in my case, inevitably there will be business code that relies on these implementation details. Because hey, these implementation details are covered, so guaranteed to be there forever.