|
|
|
|
|
by MoreQARespect
945 days ago
|
|
>It's well known that you should likely _delete these tests_ once you've written higher level ones that are more testing behaviour than implementation! Building tests only to throw them away is the design equivalent of burning stacks of $10 notes to stay warm. As a process it works. It's just 2x easier to write behavioral tests first and thrash out a good design later under its harness. It mystifies me that doubling the SLOC of your code by adding low level tests only to trash them later became seen as a best practice. It's so incredibly wasteful. |
|
I think this “2x easier” only applies to developers who deeply understand how to design software. A very poorly designed implementation can still pass the high level tests, while also being hard to reason about (typically poor data structures) and debug, having excessive requirements for test setup and tear down due to lots of assumed state, and be hard to change, and might have no modularity at all, meaning that the tests cover tens of thousands of lines (but only the happy path, really).
Code like this can still be valuable of course, since it satisfies the requirements and produces business value, however I’d say that it runs a high risk of being marked for a complete rewrite, likely by someone who also doesn’t really know how to design software. (Organizations that don’t know what well designed software looks like tend not to hire people who are good at it.)