Repository navigation
Measure code coverage of the end-to-end suite - #9
Merged
Merged
Conversation
E2E-Run.ps1 and E2E-Run-Mock.ps1 take -Coverage: after the build they instrument OpenCfDrive.Core.dll and the service's own DLL with Microsoft's dotnet-coverage (pinned in .config/dotnet-tools.json, which Dependabot's NuGet updates cover) and run a collector beside the run. Instrumented code writes its hits into memory shared with the collector, so they survive the service being killed, which is how the scripts always end it. Every service process of the run counts. At the end the collector writes coverage.cobertura.xml to the temp root and the plain DLLs go back. The tool's telemetry is turned off. It adds about 3 s to a run. CI runs the four E2E jobs with -Coverage and keeps each report with the logs. A new Code coverage job, after the others, combines them with the unit tests' report on the run's page: lines run per assembly by the unit tests, by the E2E suite and by either, and the files with the most lines no test runs. Coverage-Summary.ps1 now combines several reports, file by file and line by line, with an optional named group per column. It only reports: no minimum fails the build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Measures which code of the service the end-to-end suite runs, and shows it next to the unit tests' coverage on the run's page. With unit tests only,
CloudSyncEngine.csshowed 4.6% of its lines run, because the end-to-end suite is what tests it.How
E2E-Run.ps1andE2E-Run-Mock.ps1take-Coverage, which is off by default. After the build, they instrumentOpenCfDrive.Core.dlland the service's own DLL with Microsoft'sdotnet-coverageand run a collector beside the run. At the end, the collector writescoverage.cobertura.xmlto the temp root and the scripts put the plain DLLs back.dotnet-coverageand not coverlet: the scripts always end the service by killing it, and--stopkills too. Coverlet writes its hits when a process exits, so it would get nothing. Withdotnet-coverage, instrumented code writes its hits into memory shared with the collector, so they survive the kill. Every service process of the run counts, including the restart and the--unregistercalls..config/dotnet-tools.json. Dependabot's NuGet updates read that file, so the 7-day cooldown applies. The tool's telemetry is turned off. No new service is involved.-Coverageand keep their report in their logs artifact. A new Code coverage job runs after the others, even when one failed, and combines all the reports on the run's page. For each assembly it shows the lines run by the unit tests, by the E2E suite, and by either. Then it lists the files with the most lines no test runs.Coverage-Summary.ps1combines several reports file by file and line by line: a line counts as run if any report ran it.Name=pathgives a group of reports its own column. Microsoft's reports have no branch data, so the combined table shows lines only.docs/testing.mdexplains it all.Tested locally
Measuring adds about 3 s per run. The unit tests (coverlet 10.1.0): 281 passed. Cloud mode on S3 wasn't run locally; it runs here on CI.
Unit and E2E coverage combined on this PC:
OpenCfDrive.Core82.9% of lines (unit tests alone: 58.8%),CloudSyncEngine.cs76.3% (unit tests alone: 4.6%).🤖 Generated with Claude Code