Skip to content

Daily Test Coverage Improver: Research and Plan #1533

@github-actions

Description

@github-actions

Repository Analysis Summary

Purpose and Technology Stack

FSharp.Data is a library providing F# type providers and data access tools for structured file formats (CSV, HTML, JSON, XML) and WorldBank data. The project:

  • Uses .NET 8.0 and F#
  • Built with Fake build system
  • Uses NUnit for testing with FsUnit and FsCheck
  • Has multiple sub-projects (Core, DesignTime, Http, etc.)
  • Main build command: dotnet run --project build/build.fsproj -- -t All
  • Test-only command: dotnet run --project build/build.fsproj -- -t RunTests

Current Testing Strategy

The repository has comprehensive test coverage across multiple projects:

  • FSharp.Data.Core.Tests: Core functionality tests (JSON, HTML, CSV, HTTP)
  • FSharp.Data.DesignTime.Tests: Type provider design-time tests
  • FSharp.Data.Tests: Integration tests for providers
  • FSharp.Data.Reference.Tests: Reference/example tests

Tests are organized by functionality and use NUnit with FsUnit for readable F# test syntax.

Current Test Coverage State

No existing coverage infrastructure found:

  • No coverage tools in paket.dependencies
  • No coverage reports in CI/CD workflows
  • No existing coverage analysis in build scripts
  • This represents a significant opportunity for improvement

Test Coverage Improvement Plan

Phase 1: Infrastructure Setup

  1. Add coverage tools to paket.dependencies:

    • Add coverlet.collector and coverlet.msbuild for .NET coverage
    • Add ReportGenerator for coverage report generation
  2. Create coverage collection commands:

    • Modify test runs to collect coverage data
    • Generate XML and HTML coverage reports
    • Upload coverage artifacts for analysis

Phase 2: Coverage Analysis & Improvement

  1. Baseline coverage assessment - Generate initial coverage reports

  2. Identify low-coverage areas focusing on:

    • Core parsing logic (JSON, CSV, HTML, XML)
    • Type provider inference algorithms
    • HTTP client functionality
    • Error handling paths
    • Edge cases in data conversion
  3. Target areas for new tests:

    • JSON parsing: Complex nested structures, malformed JSON
    • CSV parsing: Various delimiters, encoding issues, missing data
    • HTML parsing: Complex selectors, malformed HTML
    • XML parsing: Namespaces, schema validation, encoding
    • Type inference: Edge cases, performance with large data
    • HTTP client: Error conditions, timeouts, authentication

Commands Needed for Build/Test/Coverage

# Restore packages
dotnet tool restore
dotnet paket restore

# Build all
dotnet run --project build/build.fsproj -- -t Build

# Run tests with coverage
dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults/

# Generate coverage report (after adding ReportGenerator)
dotnet reportgenerator -reports:"TestResults/**/coverage.cobertura.xml" -targetdir:"TestResults/CoverageReport" -reporttypes:"Html;Cobertura"

New Test Organization Strategy

  • Follow existing patterns in test projects
  • Add tests to appropriate existing test files
  • Create new test files for uncovered modules
  • Use FsUnit for readable assertions
  • Include property-based testing with FsCheck for complex scenarios

Opportunities for Significantly Increasing Coverage

  1. Property-based testing for parsers and type inference
  2. Error path testing - malformed inputs, network failures
  3. Performance edge cases - large files, memory constraints
  4. Cross-platform compatibility testing
  5. Schema validation testing for XML and JSON providers
  6. HTTP authentication and security testing

Questions for Maintainers

  1. Are there specific code coverage percentage targets we should aim for?
  2. Are there any areas of the codebase that should be excluded from coverage analysis?
  3. Should coverage reports be integrated into the CI/CD pipeline permanently?
  4. Are there specific edge cases or scenarios you'd like prioritized for testing?

Next Steps

  1. Set up coverage infrastructure (.github/actions/daily-test-improver/coverage-steps/action.yml)
  2. Generate baseline coverage report
  3. Begin systematic test additions focusing on lowest coverage areas
  4. Create pull requests with meaningful test improvements

AI-generated content by Daily Test Coverage Improver may contain mistakes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions