Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet-coverage merge drops hit counts, sets them all to 1 #16

Open
AArnott opened this issue Sep 13, 2022 · 6 comments
Open

dotnet-coverage merge drops hit counts, sets them all to 1 #16

AArnott opened this issue Sep 13, 2022 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@AArnott
Copy link
Member

AArnott commented Sep 13, 2022

Description

The merge command produces coverage data with hits="1" hard-coded for all covered lines.

Steps to reproduce

I have multiple cobertura coverage reports that I want to use dotnet-coverage merge to merge into one.

Consider these coverage files:
TestResults.zip

dotnet-coverage merge TestResults\*xml -r -o merged.cobertura.xml -f cobertura

Expected behavior

I expect the merged report to reflect the hit counts for each line.
In particular, the merged product should report that the {reporoot}\test\Library.Tests\Calculator.cs file's line 17 was hit 3 times.

I get the expected result when merging with the dotnet-reportgenerator-globaltool dotnet CLI tool.

Actual behavior

Every line reported in the merged .xml file reports hits="1".

merged outputs.zip contains outputs from both tools so you can compare.

@jakubch1
Copy link
Member

@AArnott our tooling supports only hits=1 or hits=0 for both collecting and merging. It is due to performance reasons.

@AArnott
Copy link
Member Author

AArnott commented Sep 15, 2022

Well, if this is by design, feel free to close. It seems odd that perf reasons come into play during a merge operation. And I'm surprised that tracking a bool is really that much faster than tracking and adding int, which ought to be roughly just as fast.

@jakubch1
Copy link
Member

We are considering adding possibility to collect number of hits. So let's keep this open and see if more people wants that. You are right that in case of merging this will not make it slower.

@MattKotsenas
Copy link
Member

+1 to wanting counts. We use this today to help find "hotspots" where we have duplicate tests (or duplicative test setup) that we can should clean up.

@nbalu2
Copy link

nbalu2 commented Mar 2, 2023

+1 just run into the same issue 🙄

@jakubch1 jakubch1 transferred this issue from microsoft/vstest Mar 7, 2023
@jakubch1 jakubch1 added the enhancement New feature or request label Apr 4, 2023
@tonyhallett
Copy link

This behaviour is also present when exporting from the Code Coverage Results window

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants