What is code coverage and how do YOU measure it?

后端 未结 9 1865
长情又很酷
长情又很酷 2020-12-04 04:39

What is code coverage and how do YOU measure it?

I was asked this question regarding our automating testing code coverage. It seems to be that, outside of automated

9条回答
  •  执念已碎
    2020-12-04 05:19

    Just remember, having "100% code-coverage" doesn't mean everything is tested completely - while it means every line of code is tested, it doesn't mean they are tested under every (common) situation..

    I would use code-coverage to highlight bits of code that I should probably write tests for. For example, if whatever code-coverage tool shows myImportantFunction() isn't executed while running my current unit-tests, they should probably be improved.

    Basically, 100% code-coverage doesn't mean your code is perfect. Use it as a guide to write more comprehensive (unit-)tests.

提交回复
热议问题