Muhammad Sumon Molla Selim Muhammad Sumon Molla Selim - 2 months ago 8
PHP Question

What is Codecov score and how it is measured?

I am a PHP developer and recently started writing test cases for my codes. I am using Travis CI for continuous integration and I have found another service named

Codecov.io
and integrated them with my code repository.

They are giving me a score of
54%
(https://codecov.io/gh/SumonMSelim/testing-laravel). I want to know what does this score means and how it is measured?

Answer

Coverage is used to help developers determine what lines of code were executed by their tests. There are three primary terms used to indicate the results of your tests: hit, partial and miss. The value of 54% comes from a calculation of hit / ( hits + partial + miss) = coverage.

  • A hit is a line (aka statement) that is fully executed by your tests.
  • A partial is a statement (typically a branch) that is not fully executed. Example if true:... will always be a partial hit because the branch was never skipped because true is always true.
  • A miss is a statement that was not executed by tests.

A grade of 54%, in simple terms, says "Half my code is tested". Use Codecov to investigate methods and statements in your code that are not tested to help guide you on where to write your next test and increase the coverage.

Comments