danielpalme / ReportGenerator

ReportGenerator converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats.
https://reportgenerator.io
Apache License 2.0
2.65k stars 283 forks source link

Does ReportGenerator Support "Source View" #703

Closed bgyu closed 1 week ago

bgyu commented 3 weeks ago

This is not bug report, more like a feature request. In Visual Studio Enterprise, we can view the report in "Source View" or "Project View". From current observation, it looks like ReportGenerator only supports "Project View". The view tree is based on assembly, namespace, class, functions.

When I click a source file, I can only see the coverage report for global functions, no class member functions. If I want to see class member functions, I have to click a specific type.

Is it possible that to show the coverage report in a source tree view? When I expand sources in a tree, it shows me what the coverages of a source file, which includes both global functions and member functions.

danielpalme commented 3 weeks ago

I'm not sure if I understand your request correctly. I have never used the "Visual Studio Enterprise".

Currently ReportGenerator generates an overview/summary page which list all assemblies and classes. Then you can select a class and get the full coverage information for that class including all the source lines. Here's a sample report: https://reportgenerator.io/resources/reports/Html/index.html

What are you missing? Can you provide a screenshot?

bgyu commented 3 weeks ago

This is the example I want to show you between the report of VS Enterprise and ReportGenerator:

Project View

image It shows a tree structure similar to ReportGenerator: image Summary is similar. When I click "MyHello.BasicTests.cpp": I only see the coverage of global function GlobalGreet, no coverage showed for class Hello: image

When I click class MyHello.Hello: image It only shows me the coverage of member function Greet, no global function GlobalGreet showed here.

What I want to see coverage for both in the same source file, both of them should have a green background indicates both are covered, like the following "Source View" in VS Enterprise.

Source View

image

As you can see, the coverage of file BasicTests.cpp has global function GlobalGreet and a member function Greet of Hello class, both are showing in the same view. The coverage of BasicTests.cpp is for both global functions and member functions.

danielpalme commented 2 weeks ago

ReportGenerator works on a class by class basis. What you suggest is more a file by file basis. The current approach works fine for languages like C# or Java. In those languages most files contain exactly one class.

I see, that this does not work well in your case. But I probably won't change the behavior since this would be a breaking change for all other users and would also mean to rewrite the complete tool. I'm sorry.