Skip to content

Conversation

@github-actions
Copy link
Contributor

Summary

This PR adds extensive test coverage for JsonDocument methods and HTML runtime record types that were previously at 0% coverage, following the systematic approach outlined in issue #1574.

Coverage Improvements Achieved

JsonDocument (FSharp.Data.Json.Core):

  • Coverage improvement: 61.68% → 63.2% (+1.52 percentage points)
  • 5 comprehensive test methods covering JsonDocument.Create overloads
  • Tests JsonDocument parsing from TextReader for simple/complex JSON and arrays
  • Tests JsonDocument.CreateList for handling JSON arrays and multiple objects
  • Uses reflection to safely test methods marked "for generated code only"

HTML Runtime Types (FSharp.Data.Html.Core):

  • Coverage improvement: 87.72% → 88.05% (+0.33 percentage points)
  • 6 test methods for HtmlList and HtmlDefinitionList record types
  • Tests record construction, property access, and ToString() formatting
  • Covers edge cases like empty values and definitions lists

Technical Details

Implementation:

  • New file: tests/FSharp.Data.Core.Tests/HtmlRuntimeTypes.fs - dedicated tests for HTML runtime records
  • Enhanced: tests/FSharp.Data.Core.Tests/JsonRuntime.fs - added JsonDocument-specific coverage tests
  • Project file updated: Added new test file to FSharp.Data.Core.Tests.fsproj
  • All tests passing: 2723 tests with zero regressions

Coverage Strategy:

  • Strategic focus on 0% coverage areas identified in systematic coverage analysis
  • Reflection-based testing for internal/generated-code-only methods to avoid compiler warnings
  • Comprehensive edge case testing (empty inputs, complex JSON structures, etc.)

Overall Impact

Project-wide metrics:

  • Total project line coverage: 73.7% → 74.0% (+0.3 percentage points)
  • Method coverage: 51.86% → 52.42% (+0.56 percentage points)
  • Zero breaking changes: All existing functionality preserved

Test Plan

Build successful: All projects compile without warnings
All tests passing: 2723 tests execute successfully
Code formatting clean: Fantomas formatting applied
Coverage validated: Coverlet reports confirm improvements
Zero regressions: Existing test suite unaffected

Commands to validate coverage improvements:

# Run tests with coverage collection
dotnet test tests/FSharp.Data.Core.Tests/FSharp.Data.Core.Tests.fsproj \
  /p:CollectCoverage=true \
  /p:CoverletOutputFormat=cobertura \
  /p:CoverletOutput=./TestResults/coverage.xml \
  --configuration Release

# Generate detailed coverage report  
reportgenerator \
  -reports:"tests/FSharp.Data.Core.Tests/TestResults/coverage.xml" \
  -targetdir:"TestResults/CoverageReport" \
  -reporttypes:"Html;TextSummary"

Future Work Areas

Based on this systematic approach, remaining 0% coverage opportunities include:

  • FSharp.Data.Runtime.BaseTypes.XmlElement (Xml.Core)
  • FSharp.Data.Runtime.XmlRuntime (Xml.Core)
  • FSharp.Data.Runtime.XmlSchema (Xml.Core)
  • Various WorldBank runtime classes

This PR demonstrates the effectiveness of the systematic test coverage improvement workflow outlined in the research issue.


Detailed execution log

Bash commands executed:

  • dotnet tool restore - Restored .NET tools
  • dotnet paket restore - Restored Paket dependencies
  • dotnet run --project build/build.fsproj -- -t Build - Built all projects
  • dotnet test with coverage collection - Executed tests with metrics
  • reportgenerator - Generated detailed coverage reports
  • dotnet fantomas . - Applied code formatting
  • git commands - Staged, committed, and pushed changes

Web searches performed: None

Web pages fetched: None

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

… runtime type tests

This commit adds extensive test coverage for JsonDocument methods and HTML runtime record types that were previously at 0% coverage:

**JsonDocument Coverage Improvements:**
- Added 5 comprehensive test methods covering JsonDocument.Create overloads
- Tests JsonDocument parsing from TextReader for simple/complex JSON
- Tests JsonDocument.CreateList for handling JSON arrays and multiple objects
- Uses reflection to safely test methods marked "for generated code only"
- Improved FSharp.Data.Json.Core from 61.68% → 63.2% (+1.52 points)

**HTML Runtime Types Coverage:**
- Added 6 test methods for HtmlList and HtmlDefinitionList record types
- Tests record construction, property access, and ToString() formatting
- Covers edge cases like empty values and definitions lists
- Improved FSharp.Data.Html.Core from 87.72% → 88.05% (+0.33 points)

**Technical Implementation:**
- New test file: tests/FSharp.Data.Core.Tests/HtmlRuntimeTypes.fs
- Enhanced JsonRuntime.fs with JsonDocument-specific tests
- All tests pass with zero regressions (2723 tests passing)
- Strategic focus on 0% coverage areas identified in systematic analysis

**Coverage Metrics:**
- **Total project line coverage**: 73.7% → 74.0% (+0.3 points)
- **Method coverage**: 51.86% → 52.42% (+0.56 points)
- **Zero regressions**: All existing tests continue passing

This work systematically targets the highest-impact 0% coverage areas while maintaining code quality and test reliability.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dsyme dsyme marked this pull request as ready for review September 1, 2025 00:20
@dsyme dsyme closed this Sep 1, 2025
@dsyme dsyme reopened this Sep 1, 2025
@dsyme dsyme merged commit bca3ba9 into main Sep 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants