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

filefilter exclusions still show in Report #117

Closed
nigel-friend opened this issue Dec 14, 2017 · 6 comments
Closed

filefilter exclusions still show in Report #117

nigel-friend opened this issue Dec 14, 2017 · 6 comments

Comments

@nigel-friend
Copy link

I want to filter the unit test code coverage report to only show the coverage of our own code of a specific library.

We have a very structured directory system so I want to use the filefilter to exclude the third party code (its a lot easier to filter by directory rather than class). However when I do the report still shows the classes from the filtered files, their statistics are all 0 (Covered, Uncovered, Coverable, Total and Line Coverage) and the horizontal bar graph is grey but they still take up a line. I don't want to see classes of filtered files in the report at all.

I have found that the behaviour between filtering by file and class are different. If I filter by class then the class is not shown in the report at all. Unfortunately its a lot harder for me to filter by class as the class doesn't include its namespace and I don't want to maintain a class whitelist.

I am using:
Visual Studio 2017
CodeCoverage.exe for coverage.xml generation
ReportGenerator 3.0.2

@danielpalme
Copy link
Owner

Will have a look at this within the next days.

@danielpalme
Copy link
Owner

danielpalme commented Dec 21, 2017

I fixed your problem in the following way:
If all files of a class get removed by filefilters, the whole class is removed from the report.

New release:
https://www.nuget.org/packages/ReportGenerator/3.1.1

@janlavrijsen
Copy link

janlavrijsen commented Jul 2, 2019

I also want to filter the test coverage to include in the report only source files from a certain path.
We generate (from OpenCover reports) merged XML reports, for further processing.
I tried this with ReportGenerator 4.0.4.0 and the filefilter argument, but it gives a similar problem as posted here by nigel-friend:

  • For the covered source files that are included as part of the file-filter, the XML output for the source file is as expected.
  • For the covered source files that are NOT included as part of the file-filter, I expect no XML output, but it does generate XML output with empty coverage numbers. Example:

<CoverageReport scope="Common.DataAccess.RebuildProgress">
<Summary>
<Class>Common.DataAccess.RebuildProgress</Class>
<Assembly>CommonTypes</Assembly>
<Files />
<Coveredlines>0</Coveredlines>
<Uncoveredlines>0</Uncoveredlines>
<Coverablelines>0</Coverablelines>
<Totallines>0</Totallines>
<Linecoverage></Linecoverage>
</Summary>
<Files />
</CoverageReport>

My invocation of ReportGenerator looks like:
ReportGenerator.exe "-reports:D:\opencoverreports\*.opencover.xml" "-targetdir:D:\CodeCoverageData\combinedreport" -filefilters:+*ManagedServices* -reporttypes:Xml

My question is how I can get rid of the 'empty' XML's, since they give problems during later processing by third party tools.

Thanks!
Jan

@danielpalme danielpalme reopened this Jul 2, 2019
@danielpalme
Copy link
Owner

I will have a look at the problem and come back to you.

@danielpalme
Copy link
Owner

Could you please test again with this release:
https://www.nuget.org/packages/ReportGenerator/4.2.4

@janlavrijsen
Copy link

Yes, with the 4.2.4 version it works as expected; now I don't get those XML files with 0 coverage.
Thanks for your quick help Daniel!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants