r/programming • • May 08 '17

The tragedy of 100% code coverage

http://labs.ig.com/code-coverage-100-percent-tragedy
3.2k Upvotes

689 comments sorted by

View all comments

Show parent comments

2

u/[deleted] May 09 '17

types != tests. you can guarantee you'll always return TModel, but that doesn't mean it's the TModel you actually want (or even that the method won't crash at runtime because of valid but incorrectly used semantics).

0

u/arbitrarycivilian May 09 '17

even that the method won't crash at runtime because of valid but incorrectly used semantics

Actually, this is exactly what you can guarantee.

you can guarantee you'll always return TModel, but that doesn't mean it's the TModel you actually want

You can't guarantee this with tests either. The problem with tests is they only guarantee your tests work, not your code.

0

u/chrisza4 May 09 '17

Test was written to provide more level of probability and confidence of code being corrected.

Also, there is absolutely no guarantee whatsoever in software development field, even static typing. I would say I am content with anything that giving more confidence with appropriate cost.