Test coverage is the percentage of potential defects that testing can detect — a critical quality metric measuring how thoroughly tests exercise device functionality, with higher coverage reducing escape risk but increasing test time and cost, requiring optimization to balance quality and economics.
What Is Test Coverage?
- Definition: Fraction of possible defects detectable by test suite.
- Measurement: (Detected defects / Total defects) × 100%.
- Types: Functional coverage, stuck-at fault coverage, path coverage.
- Target: >95% for consumer, >99% for automotive/medical.
Why Test Coverage Matters
- Escape Prevention: Higher coverage means fewer defects reach customers.
- Quality Assurance: Quantifies test effectiveness.
- Cost Optimization: Balance coverage vs test time/cost.
- Compliance: Automotive (ISO 26262) and medical (IEC 62304) require high coverage.
Coverage Types
Functional Coverage: Percentage of functional modes tested. Stuck-At Fault: Percentage of stuck-at-0 and stuck-at-1 faults detected. Path Coverage: Percentage of logic paths exercised. Toggle Coverage: Percentage of signals that toggle during test. Transition Coverage: State machine transitions covered.
Calculation
def calculate_test_coverage(detected_faults, total_faults):
coverage = (detected_faults / total_faults) * 100
return coverage
# Example
coverage = calculate_test_coverage(detected=9500, total=10000)
print(f"Test coverage: {coverage}%") # 95%
Improvement Strategies
- ATPG (Automatic Test Pattern Generation): Generate patterns for maximum coverage.
- Functional Vectors: Add tests for uncovered functional modes.
- Corner Case Testing: Test boundary conditions and edge cases.
- Fault Simulation: Identify untested faults and create patterns.
Trade-offs: Higher coverage increases test time and cost. Optimize for cost-effective coverage that meets quality targets.
Test coverage is the foundation of quality — comprehensive testing catches defects before shipment, but must be balanced with economic constraints to remain competitive.
Related Topics
Explore 500+ Semiconductor & AI Topics
From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.