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 merge removes branches-covered and branches-valid if source values are all 0 #148

Closed
bvande18 opened this issue Jan 7, 2025 · 3 comments

Comments

@bvande18
Copy link

bvande18 commented Jan 7, 2025

Hi, I recently ran into this while setting up a new solution and my CI/CD for a new project. I have added a test project where I tested a single class that just returned a boolean to see it was working. I know that, later down the line; we will have multiple test projects to I decided to use dotnet-coverage merge to merge all the cobertura test files I got from dotnet test. (yes redundant for a single file but it should still work correctly)

Consider this Cobertura file

<coverage line-rate="0.3333" branch-rate="1" version="1.9" timestamp="1736267691" lines-covered="4" lines-valid="12" branches-covered="0" branches-valid="0">
...
</coverage>

After the dotnet-coverage merge, I would assume I get the exact same file back (with the branches-covered and branches-valid as 0), if this is my only file. However the file I got back was the following

<coverage line-rate="0.3333" branch-rate="1" version="1.9" timestamp="1736267691" lines-covered="4" lines-valid="12" >
...
</coverage>

I would assume that the dotnet-coverage merge command line would not remove these values, especially since branch-rate is still present. But I might be mistaken. This feels like a serialization issue to me though.

@nohwnd
Copy link
Member

nohwnd commented Jan 20, 2025

@fhnaseer this is code coverage related, please have a look.

@fhnaseer
Copy link
Member

fhnaseer commented Jan 20, 2025

@bvande18 If the value is zero/empty, then it is not added to the merged file.

@fhnaseer fhnaseer transferred this issue from microsoft/vstest Jan 20, 2025
@bvande18
Copy link
Author

bvande18 commented Jan 22, 2025

@fhnaseer If it is expected behavior, we can close this issue I guess. Again I'd assume if the value is there on the unmerged files, it should be there on the merged files. But is to minor of a thing, I can work around it ;) So we can close, unless you'd want to review this and change it?

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

No branches or pull requests

3 participants