Add coverlet.collector to test project to fix CI coverage gate failure#76
Merged
Chris-Wolfgang merged 11 commits intomainfrom Mar 12, 2026
Merged
Conversation
Co-authored-by: Chris-Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix CI/CD coverage report generation in tests
Add coverlet.collector to test project to fix CI coverage gate failure
Mar 12, 2026
Chris-Wolfgang
approved these changes
Mar 12, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a CI coverage gate failure by adding the coverlet.collector NuGet package reference to the test project, which is required for dotnet test --collect:"XPlat Code Coverage" to generate coverage.cobertura.xml files.
Changes:
- Added
coverlet.collectorv6.0.4 as a dev-onlyPackageReferencescoped to net5.0–net10.0 target frameworks in the unit test project.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Chris-Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com>
Co-authored-by: Chris-Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com>
…overlet-collector-reference
Co-authored-by: Chris-Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com>
…Stage 3 only Co-authored-by: Chris-Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com>
…fix-grep-issues-in-workflow
…-workflow Fix macOS grep -P incompatibility in Stage 3 coverage threshold enforcement (pr.yaml)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dotnet test --collect:"XPlat Code Coverage"requirescoverlet.collectorto be referenced directly in the test project to activate the data collector and emitcoverage.cobertura.xml. Without it,TestResults/stays empty,CoverageReport/Summary.txtis never generated, and the Stage 1 coverage gate fails.Description
Added
coverlet.collectorv6.0.4 as aPackageReferencetoWolfgang.Etl.Abstractions.Tests.Unit.csproj, scoped to the net5.0–net10.0 target frameworks that participate in coverage collection. Consolidated into a singleItemGrouprather than duplicating across per-TFM groups.The existing
coverlet.runsettingsat the repo root was already correctly configured — no changes needed there.Type of change
How Has This Been Tested?
dotnet test --framework net8.0 --collect:"XPlat Code Coverage" --settings coverlet.runsettings --results-directory "./TestResults"locally — confirmedTestResults/**/coverage.cobertura.xmlis produced (102 passed, 12 skipped).Checklist
Screenshots (if applicable)
N/A
Additional context
coverlet.collectoris a dev-only dependency (PrivateAssets>all) and does not affect the shipped library. It is not needed on .NET Framework ornetcoreapp3.1targets because those frameworks are excluded from coverage collection in the CI workflow.Original prompt
The CI/CD workflow in .github/workflows/pr.yaml fails on the Linux coverage step because no coverage.cobertura.xml files are found in TestResults, resulting in a missing CoverageReport/Summary.txt and a failure exit code. The test project tests/Wolfgang.Etl.Abstractions.Tests.Unit/Wolfgang.Etl.Abstractions.Tests.Unit.csproj does not include a reference to coverlet.collector, which is required for dotnet test --collect:"XPlat Code Coverage" to generate coverage reports with the .NET test SDK.
Solution:
After the fix, verify that coverage.cobertura.xml is found in ./TestResults after tests run and the pipeline passes the coverage gate.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The main cause of your failing job is that no test projects were found in the ./tests directory, leading to these problems:
Solution
1. Ensure Test Projects Exist in
./testsMove or create your .NET test projects (for example, .csproj files with test code) under the ./tests directory, so that the workflow can discover them.
2. Verify Test Discovery in the Workflow Script
Your workflow runs code similar to:
If your tests are not under ./tests, this will always fail. Either:
3. Commit Example Test Projects
If you don’t have unit tests, add at least a sample test project in ./tests, even if minimal. Example:
4. Rerun the Workflow
After resolving the test project path, push your change to trigger the workflow again.
Example Directory Structure:
Summary:
Make sure your test projects are in the ./tests directory, or update the workflow paths to wherever the tests are located. This will resolve the "❌ No test projects found" error, allow tests and coverage to run, and generate the required coverage report for your job to succeed.
User: Describe this image
Assistant: The images show the structure of the ETL-Abstractions repository on GitHub.
Image 1 displays the root directory of the repository. The key folders and files visible include:
.github(workflows/scripts)benchmarksdocfx_projectdocsexamplesscriptssrc/Wolfgang.Etl.Abstractionstests/Wolfgang.Etl.Abstractions.Tests.Unit(highlighted, indicating test code exists under thetestsdirectory).editorconfig,.gitattributes, and.gitignore.Image 2 shows the contents of the
tests/Wolfgang.Etl.Abstractions.Tests.Unitdirectory. Inside, there are:BaseClassTestsandModelsReportTests.csWolfgang.Etl.Abstractions.Tests.Unit.csprojThis folder structure confirms that a test project and test files do exist under
./tests/Wolfgang.Etl.Abstractions.Tests.Unitas expected.User: so whats the issue
Assistant: Based on the images and the job log:
tests/Wolfgang.Etl.Abstractions.Tests.Unit/Wolfgang.Etl.Abstractions.Tests.Unit.csproj.❌ No test projects found in ./tests directory!Possible reasons for this apparent mismatch:
1. Shell Script Error: Array Expansion
If your workflow uses this block:
But: If there’s a problem with the shell or the environment (e.g., runni...
This pull request was created from Copilot chat.
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.