-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
Description
Summary
Add support for generating and viewing test coverage reports for the C# Valkey GLIDE client to improve code quality and ensure comprehensive test coverage.
Background
Currently, the project has unit tests and integration tests, but there's no automated way to generate test coverage reports. This makes it difficult to:
- Identify untested code paths
- Ensure new features have adequate test coverage
- Track coverage trends over time
- Meet quality gates for code coverage
Proposed Solution
Implement test coverage reporting using .NET's built-in coverage tools and integrate with the existing build pipeline.
Implementation Details
-
Add coverage collection to test commands
- Use
dotnet test --collect:"XPlat Code Coverage"
for cross-platform coverage
- Use
-
Coverage report generation
- Use
reportgenerator
tool to convert coverage data to human-readable formats - Generate both summary and detailed coverage reports
- Use
-
Build integration
- Add coverage collection to existing build scripts
- Create new build targets for coverage-specific builds
- Ensure coverage works with both net6.0 and net8.0 targets
-
CI/CD integration (optional)
- Integrate coverage reporting into GitHub Actions workflows
Example Implementation
# Collect coverage data
dotnet test --framework net8.0 --collect:"XPlat Code Coverage" --results-directory ./coverage
# Generate HTML report
dotnet tool install -g dotnet-reportgenerator-globaltool
reportgenerator -reports:"./coverage/**/coverage.cobertura.xml" -targetdir:"./coverage/report" -reporttypes:Html
Acceptance Criteria
- Coverage data can be collected for unit tests
- Coverage data can be collected for integration tests
- HTML coverage reports can be generated
- Coverage reports show line and branch coverage
- Coverage collection works with both net6.0 and net8.0 frameworks
- Coverage collection doesn't significantly impact test execution time
Additional Considerations
- Performance: Ensure coverage collection doesn't slow down regular development workflows
- Exclusions: Configure appropriate exclusions for generated code, test utilities, etc.
- Thresholds: Consider setting minimum coverage thresholds for different project areas
- Integration: Consider integration with code quality tools and IDE support
Related Work
This enhancement would complement the existing test infrastructure and support the ongoing development of comprehensive test suites for new features like AZ affinity support.