Hacker News new | ask | show | jobs
by randomdata 715 days ago
> I've generally come to think that unit tests should be used to baseline something after it ships

In theory, but I've never seen anyone successfully write tests after something ships. By that time much of the context that should be documented in tests is forgotten.

1 comments

I've done a handful of tests over the years. Once in a while the original didn't have any tests and I had no confidence I could change it without writing tests. Once in a while the original was buggy and after getting tired of going back top fix bugs I wrote a few tests. Once I had a case where the fix for bug A introduced by B, which the obvious fix was revert this code that made no sense thus bringing back bug A - when someone realized this was happening every year we write a few tests just to stop that pattern.

The above those is a very rare exception. The general rule is once code is shipped management doesn't allow you time to make it better.