Skip to content

Fix SonarQube code coverage detection#2

Merged
HaGGi13 merged 10 commits intodevelopfrom
feature/fix-collect-code-coverage
Feb 21, 2026
Merged

Fix SonarQube code coverage detection#2
HaGGi13 merged 10 commits intodevelopfrom
feature/fix-collect-code-coverage

Conversation

@HaGGi13
Copy link
Copy Markdown
Owner

@HaGGi13 HaGGi13 commented Feb 21, 2026

Fix SonarQube code coverage detection

The code coverage reports were necessary to name with the
CoverletOutput parameter, otherwise files were generated starting with
TestResults whereby this is should be the directory and not part of
the code coverage report file name.
In addition, the SonarQube prepare step was updated to point SonarQube
to the correct coverage report files. Because this library is targets
multiple frameworks, each of its test runs creates a dedicated code
coverage report file, hence a wildcard (asterisk) was necessary to used
to tell SonarQube to fetch all of those files and merge them by itself.

Instead of calling Coverlet directly via MSBuild property, the dotnet
CLI integration is used. This was done to check if the code coverage
reports are maybe merged OOTB.
Switch to using `dotnet test` with Coverlet MSBuild properties for
generating JSON and Cobertura coverage formats. Adjusted output paths
for proper merging of coverage results.
Updated the build pipeline to generate and merge test coverage reports
in OpenCover format.
Introduced `dotnet-reportgenerator` for merging coverage reports of
different target framework runs and point SonarQube to merged coverage
report location.
@HaGGi13 HaGGi13 self-assigned this Feb 21, 2026
@HaGGi13 HaGGi13 merged commit 31be0d4 into develop Feb 21, 2026
2 checks passed
@HaGGi13 HaGGi13 deleted the feature/fix-collect-code-coverage branch February 21, 2026 21:38
HaGGi13 added a commit that referenced this pull request Feb 22, 2026
Fix SonarQube code coverage detection

The code coverage reports were necessary to name with the
`CoverletOutput` parameter, otherwise files were generated starting with
`TestResults` whereby this is should be the directory and not part of
the code coverage report file name.
In addition, the SonarQube prepare step was updated to point SonarQube
to the correct coverage report files. Because this library is targets
multiple frameworks, each of its test runs creates a dedicated code
coverage report file, hence a wildcard (asterisk) was necessary to used
to tell SonarQube to fetch all of those files and merge them by itself.
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.

1 participant