Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I agree. I think it's important that your test suite gives you something useful with every test, instead of writing a bunch of pointless extra tests just to get to 100% coverage because you read somewhere that that's good.

I feel like I ought to write more on this one of these days, but I have a few testing pet peeves, as far as tests you shouldn't write. Don't write tests that are a copy-paste of the code you're testing. Don't write tests to validate things that should be proven by your type system and lack of compile/parse errors. Beware of tests so tied to implementation details that they make your code harder to refactor. Don't write tests for things talking to external services - the only real test is that it correctly handles the actual service responses.



Tests should be testing behavior, not implementation (this was the original intent of unit testing but it got sidetracked over time).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: