Hacker News new | ask | show | jobs
by kempbellt 2475 days ago
So, don't bother writing any tests unless you can test everything?

At a previous shop, we had a simple test that ensured user could log in for a while, until we created more coverage. We didn't test every aspect of the code. This simple sanity check saved us once or twice.

Should we have not written this test just because we couldn't test every conceivable piece of code?

Don't let perfect be the enemy of good...

1 comments

Exactly this, plus, the entire concept of 100% coverage is hilariously wrong.

Are you covering 100% of code interactions? How much of your integration logic are you mocking? Are you covering 100% of HTML and interface logic? How much code is not in your code? What about packages and imports? It's incredibly arbitrary for no good reason except to slow development of a product that may depend on fast development for survival in trade to test for bugs that honestly, actually, may never happen. To be clear, testing is good, but you write tests to serve the code and product, not the other way around.