Hacker News new | ask | show | jobs
by taylodl 3399 days ago
I addressed a lot of these concerns in my blog post on Maintenance Driven Development. https://taylodl.wordpress.com/2012/07/21/maintenance-driven-...

Yes, fine-grained tests are problematic and as such one tends to desire to minimize the creation of such tests as much as possible. But when bugs are discovered then it may be necessary to create fine-grained tests in that affected area. Essentially what you're doing is the most extensive testing in the area of your code giving you the most problems. If you notice a particular area of your code requiring a lot of extensive unit tests then perhaps it's time to consider refactoring that code.

1 comments

I've seen lots of unit tests tests trying to reproduce the exact circumstances of a known bug, in an attempt to trigger it, and thus prevent regressions.

The problem is, legitimate changes to your production code can make your test go blind. What I mean is that the test looses its ability to trigger the bug, while the potential for the bug to be re-introduced is still high.

This is what happens if you're trying to trigger known bugs instead of asserting behaviours: your tests might stop playing their role and you won't even notice.