Skip to content

Fix xunit.v3 test discovery and code coverage in CI (dotnet test / VSTest incompatibility) - #4

Merged
MichaConrad merged 9 commits into
mainfrom
copilot/add-basic-repository-features
Feb 22, 2026
Merged

MichaConrad merged 9 commits into
mainfrom
copilot/add-basic-repository-features

Conversation

Copilot AI commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

xunit.v3 runs via the Microsoft Testing Platform (MTP) in-process runner; dotnet test defaults to VSTest discovery, which cannot see MTP-hosted tests — producing "No test is available" and, consequently, 0% coverage from an empty run.

CDT.Tests.csproj

Two MSBuild properties wire up the MTP pipeline end-to-end:

<!-- Routes dotnet test / MSBuild from the VSTest target to the MTP target -->
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<!-- Activates the MTP runner inside the test host -->
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>

Both are required — the first fixes the MSBuild/dotnet test side, the second fixes the runner side. Either one alone is insufficient.

coverlet.collector was also replaced with coverlet.msbuild. The collector variant hooks into VSTest's IDataCollector API which MTP bypasses entirely, leaving the coverage XML file unwritten (hence ReportGenerator failing with "no matching files"). coverlet.msbuild rewrites IL at build time and is runner-agnostic.

.github/workflows/ci-cd.yml

The Test steps were updated to use coverlet.msbuild MSBuild properties instead of the VSTest-only --collect:"XPlat Code Coverage" argument:

/p:CollectCoverage=true
/p:CoverletOutputFormat=cobertura
/p:CoverletOutput=${{ github.workspace }}/coverage/coverage.cobertura.xml

The ReportGenerator input path was updated to match the workspace-absolute output location.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 22, 2026 09:51
Co-authored-by: MichaCo <5837539+MichaCo@users.noreply.github.com>
Co-authored-by: MichaCo <5837539+MichaCo@users.noreply.github.com>
Copilot AI changed the title [WIP] Add basic repository features including CI/CD and README Add CI/CD pipeline, NuGet package metadata, upstream sync, and README Feb 22, 2026
Copilot AI requested a review from MichaConrad February 22, 2026 09:54
@MichaConrad

Copy link
Copy Markdown
Collaborator

@copilot Thats great, now

  • create more sophisticated examples in the readme
  • test them to make sure they actually work
  • Look at the original c++ repos' readme
    • mention the original repo and
    • add any information to ours which might be very important (don't copy all the things, just if you find something note worthy)
    • and mention to look at hte soruce repo for documentation and all that because we'll not port all that over
    • Give proper credit

…rthy info from upstream

Co-authored-by: MichaCo <5837539+MichaCo@users.noreply.github.com>

Copilot AI commented Feb 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Thats great, now

  • create more sophisticated examples in the readme
    ...

Done in da1e0d4. Here's what changed:

README improvements:

  • Added a proper "What is CDT?" section explaining constrained vs. conforming DT
  • Pre/post-conditions section (no duplicate vertices, CCW winding) — ported from upstream
  • 6 sophisticated, fully working examples: convex hull, constrained DT with bounded domain, auto-detected holes (even–odd depth rule), conforming DT, duplicate vertex removal + edge remapping, and resolving intersecting constraint edges
  • Credited the original C++ repo and its contributors with the MPL-2.0 attribution template, and linked to the upstream docs for full algorithm/API documentation since we won't port all of that

Tests:

  • Added ReadmeExamplesTests.cs with 7 tests (one per example) that validate every code snippet in the README compiles and produces the expected output — all passing.

@MichaConrad
MichaConrad marked this pull request as ready for review February 22, 2026 10:19
@MichaConrad

Copy link
Copy Markdown
Collaborator

@copilot Looks like the build is failing becasue our VIZ app must target windows only

can you fix that?

  Determining projects to restore...
Error: /usr/share/dotnet/sdk/10.0.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(120,5): error NETSDK1100: To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true. [/home/runner/work/CDT.NET/CDT.NET/viz/CDT.Viz/CDT.Viz.csproj]
Error: Process completed with exit code 1.

…ject

Co-authored-by: MichaCo <5837539+MichaCo@users.noreply.github.com>
Co-authored-by: MichaCo <5837539+MichaCo@users.noreply.github.com>
@MichaConrad

Copy link
Copy Markdown
Collaborator

Great!

@copilot

Now, why is the CI/CD reporting 0% code coverage at the end though?
I see that the report is generated and attached to the pipeline output

image

How can that be with 990 tests?

…est-comment

Co-authored-by: MichaCo <5837539+MichaCo@users.noreply.github.com>
… in CI

Co-authored-by: MichaCo <5837539+MichaCo@users.noreply.github.com>
Copilot AI changed the title Add CI/CD pipeline, NuGet package metadata, upstream sync, and README Fix xunit.v3 test discovery in CI (dotnet test / VSTest incompatibility) Feb 22, 2026
@MichaConrad

Copy link
Copy Markdown
Collaborator

@copilot

Now both builds fail in the step to report on code coverage with

Installing ReportGenerator global tool (https://www.nuget.org/packages/dotnet-reportgenerator-globaltool)
/usr/share/dotnet/dotnet tool install dotnet-reportgenerator-globaltool --tool-path reportgeneratortool --version 5.5.1 --ignore-failed-sources
You can invoke the tool using the following command: reportgenerator
Tool 'dotnet-reportgenerator-globaltool' (version '5.5.1') was successfully installed.
Successfully installed ReportGenerator global tool
Executing ReportGenerator
/home/runner/work/CDT.NET/CDT.NET/reportgeneratortool/reportgenerator -reports:./coverage/**/coverage.cobertura.xml -targetdir:coveragereport -reporttypes:MarkdownSummaryGithub -sourcedirs: -historydir: -plugins: -assemblyfilters:+* -classfilters:+* -filefilters:+* -riskhotspotassemblyfilters:+* -riskhotspotclassfilters:+* -verbosity:Info -title: -tag:7_22275618183 -license:
2026-02-22T10:47:16: The report file pattern './coverage/**/coverage.cobertura.xml' found no matching files.
2026-02-22T10:47:16: No report files specified.
Error: Failed to execute ReportGenerator global tool

…t.v3 runner

Co-authored-by: MichaCo <5837539+MichaCo@users.noreply.github.com>

Copilot AI commented Feb 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

Now both builds fail in the step to report on code coverage with
...

Fixed in d5b7afe. Root cause: coverlet.collector uses VSTest's data-collection callbacks, which MTP silently ignores — so the XML file was never written, leaving ReportGenerator nothing to find.

Switched to coverlet.msbuild (which rewrites IL at build time, independent of the test runner) and updated the Test steps to pass /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=... instead of --collect:"XPlat Code Coverage". Verified locally: 997 tests pass and coverage.cobertura.xml is generated with 85.86% line coverage.

Copilot AI changed the title Fix xunit.v3 test discovery in CI (dotnet test / VSTest incompatibility) Fix xunit.v3 test discovery and code coverage in CI (dotnet test / VSTest incompatibility) Feb 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Summary

Summary
Generated on: 2/22/2026 - 10:55:45 AM
Coverage date: 2/22/2026 - 10:55:41 AM
Parser: Cobertura
Assemblies: 1
Classes: 17
Files: 7
Line coverage: 85.8% (1227 of 1429)
Covered lines: 1227
Uncovered lines: 202
Coverable lines: 1429
Total lines: 3230
Branch coverage: 80.4% (602 of 748)
Covered branches: 602
Total branches: 748
Method coverage: Feature is only available for sponsors
Tag: 8_22275718617

Coverage

CDT.Core - 85.8%
Name Line Branch
CDT.Core 85.8% 80.4%
CDT.Box2d`1 73.3% 100%
CDT.CdtUtils 68% 50%
CDT.CovariantReadOnlyDictionary`3 18.1% 50%
CDT.DictionaryExtensions 100% 100%
CDT.DuplicatesInfo 100%
CDT.DuplicateVertexException 66.6%
CDT.Edge 75% 66.6%
CDT.IntersectingConstraintsException 0%
CDT.KdTree`1 72.5% 65%
CDT.LayerDepth 0%
CDT.Predicates 79.5% 91.8%
CDT.TopologyVerifier 77.2% 63.8%
CDT.Triangle 69.5% 71.4%
CDT.TriangleUtils 94.7% 87%
CDT.Triangulation`1 94.6% 84.2%
CDT.TriangulationException 100%
CDT.V2d`1 44.4% 25%

@MichaConrad
MichaConrad merged commit 6bb8304 into main Feb 22, 2026
3 checks passed
@MichaConrad
MichaConrad deleted the copilot/add-basic-repository-features branch February 22, 2026 10:56
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