coverlet-coverage / coverlet

Cross platform code coverage for .NET
MIT License
2.93k stars 386 forks source link

Cobertura report filenames different based on Operating System #1527

Closed adc-cjewett closed 10 months ago

adc-cjewett commented 10 months ago

Based on previous issues it seems like the expectation is Cobertura reports should output a relative path. I noticed that when building and testing one of our repositories on Windows and Linux I was seeing differing behavior. The Windows machine uses the absolute path in the filename while the Linux machine uses the relative path. What is the expectation there?

You can use this repo to replicate by running https://github.com/adc-cjewett/PartialClassCodeCoverage dotnet test --collect "Code Coverage;Format=Cobertura" at the root of the repo then checking the results.

daveMueller commented 10 months ago

Hi, the collector you are using is not coverlet. It is the data collector build in vstest (different collector name). For using coverlet you need to add our coverlet.collector nuget package to your test projects and then run dotnet test --collect:"XPlat Code Coverage;Format=cobertura".

adc-cjewett commented 10 months ago

Ah, apologies! I'll create an issue over on the Microsoft.CodeCoverage project.

daveMueller commented 10 months ago

I was curious myself and tried out your repo. For cobertura reports we use relative paths by default regardless of the operating system.

Windows: grafik

Linux: grafik