| name | dotnet-testing-code-coverage-analysis |
| category | testing |
| subcategory | fundamentals |
| description | Complete guide for code coverage analysis. Use when you need to analyze code coverage, generate coverage reports, or configure CI/CD coverage checks. Covers Coverlet configuration, report generation, metric interpretation, and cyclomatic complexity integration. Includes Fine Code Coverage, VS Code built-in tools, and best practices.
Keywords: code coverage, coverage analysis, coverage report, Coverlet, Fine Code Coverage, dotnet-coverage, ReportGenerator, line coverage, branch coverage, cyclomatic complexity, runsettings, cobertura
|
| targets | ["*"] |
| license | MIT |
| metadata | {"author":"Kevin Tseng","version":"1.0.0","tags":"code-coverage, coverlet, testing-metrics, quality, ci-cd, analysis","related_skills":"unit-test-fundamentals, xunit-project-setup"} |
| claudecode | {} |
| opencode | {} |
| codexcli | {"short-description":".NET skill guidance for dotnet-testing-code-coverage-analysis"} |
| copilot | {} |
| geminicli | {} |
| antigravity | {} |
Source: kevintsengtw/dotnet-testing-agent-skills (MIT). Ported into dotnet-agent-harness.
Code Coverage Analysis Guide
Applicable Scenarios
Use this skill when asked to perform the following tasks:
- Configure and execute code coverage analysis
- Configure Coverlet or other coverage tools
- Generate and interpret coverage reports
- View coverage in Visual Studio or VS Code
- Evaluate test completeness and quality
- Combine complexity metrics to formulate testing strategies
Code Coverage Core Concepts
Definition
Code Coverage is a measurement metric used to count how much code is actually executed during test execution.
Correct Understanding
Actual Value of Code Coverage
- Find Testing Blind Spots: Quickly identify code not tested
- Evaluate Test Completeness: Check if important logic is tested
- Assist Refactoring Decisions: Understand which areas need more attention
- Increase Testing Confidence: Confirm critical paths are validated
Common Misconceptions (Must Avoid)
❌ Wrong Understanding:
- 100% coverage means no bugs
- Higher coverage numbers are always better
- Can use coverage as KPI
✅ Correct Understanding:
- Code coverage is just a reminder tool, telling you which code is not tested
- Focus on test effectiveness, not coverage numbers
- Helps determine if more test cases are needed
- Should never be used as KPI
⚠️ Warning: When Code Coverage is used as KPI, developers write tests without Asserts just to boost numbers,
completely losing the meaning of testing.
.NET Project Coverage Tool Selection
1. Visual Studio Enterprise (Enterprise Edition Only)
Pros
- Built-in integration, no additional configuration needed
- Complete UI support
- Real-time results display
Limitations
- Only Enterprise version has this feature
- Professional and Community versions not supported
2. Fine Code Coverage (Recommended Free Option)
Pros: (continued)