The true purpose of code coverage __numbers

Source: Internet
Author: User
In a sentence:code coverage tells your what you definitely Haven ' tTested, not what have.

Part of building a valuable unit test suite is finding the most important, high-risk code and asking hard of it. You are want to make sure the tough stuff works as a priority. Coverage figures have no notion of the ' importance ' of code, nor the quality of tests.

In my experience, many of the most important tests your'll ever write are the tests that barely add no coverage at all ( Edge cases that add a few extra% here and there, but find loads of bugs).

The problem with setting hard and (potentially counter-productive) coverage targets-is-developers may have to start B Ending over backwards to test their code. There ' s making code testable, and then There ' s just torture. If you are hit 100% coverage with great tests then that's fantastic, but in most situations the extra effort are just not worth It.

Furthermore, people start obsessing/fiddling with numbers rather than to on the focussing of the quality. I ' ve seen badly written tests that have 90+% coverage, just as I ' ve seen excellent tests this only have 60-70%.

Again, I tend to look at coverage as a indicator of what definitely ' t hasn been.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.