Code-Coverage (EN)

Term

Metric measuring what percentage of source code is executed by tests

Definition

Code-Coverage is a metric that indicates what percentage of the source code was executed by the tests. Key metrics include line, branch, and path coverage, which measure different aspects of test coverage. High coverage does not automatically guarantee test quality, as it only shows which code areas were executed, but not whether the tests are meaningful or cover critical scenarios.

Types of Code-Coverage

flowchart TD   A[Code-Coverage] --> B[Line Coverage]   A --> C[Branch Coverage]   A --> D[Path Coverage]   A --> E[Condition Coverage]      B --> F[Percentage of executed code lines]   C --> G[Percentage of code paths through if/else/switch]   D --> H[Percentage of possible path combinations]   E --> I[Percentage of logical conditions] 

In Context

  • Typically used together with test frameworks such as JaCoCo, Istanbul or Cobertura
  • Related to: Test automation, Continuous Integration, Software quality
  • Example use: Setting coverage targets (e.g. 80% line coverage) in CI/CD pipelines
Quelle: AI Generated