Overview

Code coverage provides a rough indicator of how well your code is tested. However, high coverage does not guarantee high quality; it only means the code was executed, not that it was correctly verified.

Common Metrics

  • Statement Coverage: Percentage of lines of code executed.
  • Branch Coverage: Percentage of decision points (if/else) executed.
  • Function Coverage: Percentage of functions called.

Best Practices

Aim for a reasonable coverage level (e.g., 80%), but focus more on writing meaningful tests that cover critical business logic and edge cases.

Related Terms