3 ms·
It's extremely common to write unit tests that only test success cases but not error cases. It's pretty much a special case of confirmation bias, as illustrated
by mikeash 11y ago
It's extremely common to write unit tests that only test success cases but not error cases. It's pretty much a special case of confirmation bias, as illustrated by the classic "2-4-6 task" (implemented here as 2-4-8, but it's the same idea):
http://www.nytimes.com/interactive/2015/07/03/upshot/a-quick-puzzle-to-test-your-problem-solving.html?_r=0 http://www.nytimes.com/interactive/2015/07/03/upshot/a-quick...
You're totally right that you should have a unit test that verifies failure with invalid credentials, not just success with valid credentials. But a lot of programmers are not as smart as you are here!
- gardano 11y agoI guess my worry is that I don't know what I don't know (regarding security), but I'm pretty sure there are use-cases that haven't even been defined yet (insert favourite Relmsfeld quote here).
- mikeash 11y agoSecurity is hard, no doubt, and even careful tests may not turn up all problems. Not testing your negative cases at all is such a basic failure, and an extremely common one too.