3 ms·
The "threat" of having to add unit tests should force developers to write their classes and components in a way that is easy to reason about. In particular: * p
by rbalicki 10y ago
The "threat" of having to add unit tests should force developers to write their classes and components in a way that is easy to reason about. In particular:
* put as much functionality into pure functions
* depend less on statically-linked globals
* import all significant collaborators across seams that can be mocked.
* keep state in a small atom, rather than strewn about
If you write code like that, you get many of the benefits of unit tests, whether or not they are actually written.
Perhaps it's a good idea to write a test harness (e.g. larger integration tests) for old so that you have a reasonable chance of catching it if it becomes broken, and focus on writing new code in a testable fashion.
- misha67 10y agoThe threat of having to write unit tests will not have nearly the effect of actually writing them. It's too easy to fool yourself into thinking you've written testable code.