SteveGilham / altcover

Cross-platform coverage gathering and processing tool set for dotnet/.Net Framework and Mono
MIT License
498 stars 18 forks source link

Question Regarding assemblies being added to code coverage result #217

Closed bigboybamo closed 5 months ago

bigboybamo commented 5 months ago

Hi,

I am new to atlcover, I ran To generate my xml file

dotnet test /p:AltCover=true

and then used Report generrator to visualize it.

But then, I'm wondering my why these assemblies where added since I just imported the libraries and didnt actually write any code there

image image

Maybe I am missing something?

edit: Or is it possible to define only the projects i want coverage on in dotnet test /p:AltCover=true ?

For more context, this what i get when i ran the command in the cmd

image
SteveGilham commented 5 months ago

The short answer is that I do not know which assemblies are the ones you are interested in. I can't (for example) just automatically exclude Microsoft.* assemblies, because a Microsoft engineer might well be using this tool. I certainly can't automatically exclude AltCover.* assemblies since I use to tool in self-testing.

The long answer is that it used to be the case that third party libraries arrived without .pdb files for the symbols needed to determine where lines of code mapped to the compiled assembly, so would automatically be excluded from coverage tracking, but the arrival of ubiquitous embedded symbols over the past decade or so has invalidated this assumption.

Often dotnet test /p:AltCover=true /p:AltCoverLocalSource=true or dotnet test /p:AltCover=true /p:AltCoverAssemblyFilter="?[my product name]" will do what you require, but even those may require more fine tuning.

bigboybamo commented 5 months ago

Hi @SteveGilham

Running dotnet test /p:AltCover=true /p:AltCoverLocalSource=true fixed my issue.

many thanks