Code Coverage: Is 90-95% really necessary?
In the engineering improvement runbook, Don Brown discusses testing and code coverage. He introduces the concept of a testing pyramid with smoke tests at the top, end-to-end tests in the middle, integration tests below that, and unit tests forming the base. The number of tests decreases as you move up the pyramid. Brown emphasizes that setting code coverage targets depends on the complexity of the code being tested. For instance, a parser or protocol implementation should be massively tested, while getters and setters may not need unit testing at all. Unit tests can also serve as documentation for developers, reducing risks associated with changes in production. In conclusion, while 90-95% code coverage might be necessary in some cases, it's not always required. The key is to understand the complexity of the code and adjust testing efforts accordingly.
Company
Sleuth
Date published
Oct. 21, 2021
Author(s)
Don Brown
Word count
1083
Language
English
Hacker News points
None found.