Code Coverage

Code Coverage is a metric that measures the amount of code executed during testing, expressed as a percentage. It helps identify untested parts of the codebase, ensuring more thorough test coverage and improving software quality. Key points:

Types:

Calculation:

  • (Executed code / Total code) * 100

Tools:

  • JaCoCo
  • Istanbul
  • gcov

Benefits:

  • Identifies untested code
  • Guides test case creation

Limitations:

  • High coverage doesn’t guarantee quality
  • This may lead to inefficient testing

Code Coverage helps assess the thoroughness of testing efforts.