coverlet-coverage / coverlet

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

When exclude assambly in xml ouput show that assambly but empty tag #1526

Open allnnde opened 10 months ago

allnnde commented 10 months ago

Hi, I am trying to generate a coverage report, but when I exclude a namespace it appears in the xml but without data.

Sorry for my english

my runsettings image

de command to run dotnet test --no-build --verbosity d --collect:"XPlat Code Coverage" --settings .runsettings --results-directory ./coverage

xml ouput image

thx

Bertk commented 10 months ago

Hi,

thank you for reporting this issue.

I assume you are using the latest version of coverlet.collector. Please try again using the latest pre-release form nightly build. You should also use the verbosity option dotnet test --logger "console;verbosity=detailed".

https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/ConsumeNightlyBuild.md

https://dev.azure.com/tonerdo/coverlet/_artifacts/feed/coverlet-nightly/NuGet/coverlet.collector

allnnde commented 10 months ago

hello, I did the test with that version that you have indicated me and the same thing happened to me, I attach the log of the testing step 6_Test.txt

Bertk commented 10 months ago

Thanks for the log file. Could you please try to use ExcludeByFile instead.

MSBuildIntegration.md#excluding-from-coverage (related issue: #56)

allnnde commented 9 months ago

same result :( image image

allnnde commented 9 months ago

I attach the last log of the testing step 6_Test.txt

Bertk commented 9 months ago

There is another related issue #830 and ExcludeByFile example which use directory filter.

image

Maybe you can use **/elearming-backend/**/*

allnnde commented 9 months ago

I can't use the filter **/elearming-backend/**/* because otherwise it ignores the whole project.

Bertk commented 8 months ago

@allnnde The coverlet build.yml uses now exclude parameter (uses coverlet.msbuild) but the syntax for excludeis identical.

The following lines are an excerpt from #1503 A) Using coverlet.collector Exclude option (special CLI syntax " -- " separator for command and settings)

dotnet test bug-tests-in-coverage.sln -c Release --collect="XPlat Code Coverage" --results-directory="TestResults/" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Exclude="-[MyApp.Application.Tests]"

B) Using reportgenerator assemblyfilters option

reportgenerator -reports:"TestResults/*/coverage.cobertura.xml" -targetdir:"CoverageReports/" -reporttypes:"HtmlSummary;TextSummary" -assemblyfilters:"-MyApp.Application.Tests"

Please try: <Exclude>[Elearning_Backend.Domain]*</Exclude>

github-actions[bot] commented 5 months ago

This issue is stale because it has been open for 3 months with no activity.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 3 months with no activity.