-
Notifications
You must be signed in to change notification settings - Fork 285
Description
Research and Plan for Test Coverage Improvement
Repository Analysis
Purpose and Technology Stack
FSharp.Data is a comprehensive F# library that provides type providers and utilities for accessing common data formats (CSV, HTML, JSON, XML) and external data sources like WorldBank. The project is organized into multiple modules:
- Core Libraries: CSV.Core, Json.Core, Html.Core, Xml.Core, Http, WorldBank.Core, Runtime.Utilities
- Design-Time Components: Type providers for compile-time code generation
- Main Package: FSharp.Data combining all components
Current Testing Strategy
The project has a well-established testing structure with multiple test projects:
-
FSharp.Data.Core.Tests - Core functionality tests covering:
- CSV parsing and operations
- JSON parsing, conversions, and runtime behavior
- HTML parsing, CSS selectors, operations
- HTTP functionality and headers
- Text conversions and runtime utilities
- Caching mechanisms
-
FSharp.Data.DesignTime.Tests - Type provider signature tests
- Comprehensive signature validation for all type providers
- Inference testing for various data formats
- Expected output validation against .expected files
-
FSharp.Data.Tests - High-level integration tests for type providers
-
FSharp.Data.Reference.Tests - Additional reference tests
-
FSharp.Data.Core.Tests.CSharp - C# interoperability tests
Build and Test Infrastructure
Build Commands:
- Build:
dotnet run --project build/build.fsproj -- -t Build - Run Tests:
dotnet run --project build/build.fsproj -- -t RunTests - Full Build:
dotnet run --project build/build.fsproj -- -t All - Format:
dotnet run --project build/build.fsproj -- -t Format - Check Format:
dotnet run --project build/build.fsproj -- -t CheckFormat
Test Execution: Uses dotnet test with Release configuration and GitHub Actions logger in CI.
Current Test Coverage Assessment
Current Gaps Identified:
- No code coverage collection is currently configured in the build process
- Missing coverage reports and metrics
- TestResults/CoverageReport directory exists but is empty
Test Organization:
- Tests are well-organized by module and functionality
- Comprehensive test data in Data/ directories
- Clear separation between unit tests, integration tests, and signature tests
- C# interoperability tests ensure cross-language compatibility
Improvement Strategy
1. Coverage Collection Setup
Need to configure code coverage collection using tools like:
- Coverlet for .NET Core coverage collection
- ReportGenerator for HTML coverage reports
- Integration with the existing FAKE build system
2. Coverage Analysis Commands
# Generate coverage with Coverlet
dotnet test --collect:"XPlat Code Coverage" --results-directory TestResults/
# Generate HTML reports
dotnet reportgenerator -reports:"TestResults/**/coverage.cobertura.xml" -targetdir:"TestResults/CoverageReport" -reporttypes:Html3. Areas for Potential Coverage Improvement
High Priority Areas:
- Error handling and edge cases - Exception paths, malformed input
- Runtime utilities - TextConversions, NameUtils, Pluralizer
- Inference engines - CsvInference, JsonInference, XmlInference, HtmlInference
- Extension methods and helpers - Various *Extensions.fs files
- Caching mechanisms - Current caching logic and cache invalidation
- HTTP functionality - Different request types, headers, authentication
Medium Priority Areas:
- Type provider runtime support - Runtime behavior verification
- Cross-platform compatibility - Different OS/culture scenarios
- Performance-critical paths - Parsing optimizations
- Schema validation - JSON Schema, XSD validation paths
4. Testing Approach
- Focus on meaningful tests that exercise real functionality
- Target uncovered branches and exception handling
- Add property-based tests for parsers where applicable
- Ensure tests cover different data formats and edge cases
- Maintain compatibility with existing test patterns
5. Integration with CI/CD
- Add coverage collection to GitHub Actions workflows
- Generate coverage reports as build artifacts
- Set coverage quality gates for future PRs
Questions for Maintainers
- Coverage Target: What would be a reasonable coverage target for this project?
- Tools Preference: Any preference for coverage collection tools (Coverlet vs alternatives)?
- Reporting: Should coverage reports be published as GitHub Pages or artifacts?
- Breaking Changes: Any areas where additional testing might reveal existing issues?
- Performance: Any concerns about coverage collection impacting build time?
Next Steps
- Configure coverage collection in the build system
- Generate baseline coverage report
- Identify specific uncovered areas
- Create targeted tests for highest-impact coverage improvements
- Set up automated coverage reporting
AI-generated content by Daily Test Coverage Improver may contain mistakes.