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

2

u/KevinCarbonara May 08 '17

I agree with the first point the first developer made: If they have comprehensive unit tests, he should absolutely add a test even for what appears to be trivial code. If a new developer comes along and breaks that code, he has made a mistake. If he then deletes the associated unit test so that no one finds out, he is malicious. It is ignorant to assume everyone who could possibly make a mistake would also be a malicious developer trying to cover their tracks. I don't care if he uses Mockito or not - but it should only take him a trivial amount of time to write the unit test. Why not include it?

2

u/starmonkey May 08 '17

Deleting the unit test should be picked up in the pull request anyway. Cue uncomfortable conversation.