3 ms·
> if he spent barely 20 minutes writing 3–4 trivial unit tests for this function, we would have saved probably 6 hours each ... The math was beyond simple. 20 m
by throw310822 4y ago
> if he spent barely 20 minutes writing 3–4 trivial unit tests for this function, we would have saved probably 6 hours each ... The math was beyond simple. 20 mins invested and 12 hours saved.
I've heard this reasoning before. The math is simple but wrong. The cost of writing unit tests must also include the time spent on tests of stuff that was never broken; and for the maintenance of tests that break because of new features or bug fixes rather than actual code issues.
Unit tests are very useful, essential, in some situations. In others they're a waste of everybody's time.