FortuneN / FineCodeCoverage

Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)
https://marketplace.visualstudio.com/items?itemName=FortuneNgwenya.FineCodeCoverage
Other
522 stars 40 forks source link

Visual Studio does not highlight available coverage information when opening covered files #447

Closed klaus1212 closed 1 month ago

klaus1212 commented 1 month ago

Installed product versions

Description

Fine Code Coverage view shows line coverage of my C++ files. When I click a file in the coverage report, visual studio opens the file but it does not highlight the lines covered/ not covered in any way.

Steps to recreate

  1. Install the Fine Code Coverage extension
  2. Apply Ms code coverage
  3. Run unittests
  4. Open Fine Code Coverage report
  5. Click on a file with some coverage
  6. None of the lines in the file are highlighted Coverage not highlighted

Current behavior

Files shows line coverage information in Fine Code Coverage report, but none of the files highlights coverage information when opening a file.

Expected behavior

Opening a file should highlight the coverage information available in the file.

tonyhallett commented 1 month ago

Have you set ShowEditorCoverage as true ?

image

and

image
klaus1212 commented 1 month ago

Yes I have, these are my settings

image

tonyhallett commented 1 month ago

Can you share your solution or provide a minimal solution that exhibits this behaviour. What testing framework are you using ?

klaus1212 commented 1 month ago

I will have to get back to you on the source code example. The testing framework I am using is googletest.

tonyhallett commented 1 month ago

Please do and I will have a look.

Just note that FCC was developed for C#. The availability of microsoft code coverage and its ability to provide coverage for C++ allowed for the disclaimer

Supports C++ ! Note that FCC has not been properly tested with C++ projects but with a simple C++ class, tested with Google Test.

tonyhallett commented 1 month ago

In the meantime you could post the cobertura file in the fcc directory within your test project.

klaus1212 commented 1 month ago

Here is the cobertura file, I renamed it to txt since xml is not supported. Cobertura.txt

tonyhallett commented 1 month ago

Is there editor marks for the cpp files ?

tonyhallett commented 1 month ago

I have checked that FCC responds to hpp files and it does. The cobertura looks fine as well.

klaus1212 commented 1 month ago

Hi,

While I was creating the example project, I earlier in this thread agreed to return with, I found out that my problem was my custom fcc-ms-runsettings-template.xml file. Intially the example project I was working on posting here did not contain the ms-runsettings-template.xml file. Hence I noticed that coverage worked with source file highlighting and everything :-)

Digging into it I noticed I was missing a ModulePath include for my unittest executables in the fcc-ms-runsettings-template.xml. Therefore when I updated fcc-ms-runsettings-template.xml to use the FCC autogenerated modulepath (%fcc_modulepaths_include%) it worked :-)

So to conclude I have line coverage working - I get a report and source files highlighted with coverage. Only thing I do not see is branch coverage? I only see line coverage.

Is branch coverage not part of FCC when using MS Code Coverage for FCC

tonyhallett commented 1 month ago

https://github.com/microsoft/codecoverage/issues/22