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

Because code coverage should measure coverage of REQUIREMENTS, not lines of code.

Right coverage metric would take as input list of all requirements broken into smallest conditions and then check if they all are verified by a unit test.

In particular, this would cause almost all code to be covered because if a line of code was not covered by test it would mean it is not necessary to meet any of the requirements.

Interestingly enough, unit tests would also be then complete documentation of every single requirement and that is how I understand "test driven development". Sadly, I have yet to see it implemented anywhere.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: