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

Fine code coverage is not visible #289

Closed roopahtshree closed 8 months ago

roopahtshree commented 2 years ago

I'm using Microsoft Visual Studio Professional 2019 Version 16.11.18 . i have created a simple google test project in c++. in the test explorer 1 test case is getting passed, but fine code coverage summary is showing all as 0

Below is the coverage log Generating html report Cobertura report generation duration - 00:00:00.8341873 Generating cobertura report Completed coverage for (Sample-Test1) : 00:00:04.9284836 Run OpenCover (Sample-Test1) File synchronization 7 items, duration : 00:00:00.0322093 Starting coverage - full details in FCC Output Pane Coverage collected when tests finish. RunInParallel option true for immediate See option RunMsCodeCoverage for a better (Beta) experience. View readme. Html report generation duration - 00:00:01.3744892 Generating html report Cobertura report generation duration - 00:00:00.9058176 Generating cobertura report Completed coverage for (Sample-Test1): 00:00:05.0150038 Run OpenCover (Sample-Test1) File synchronization 7 items, duration : 00:00:00.0394546 Starting coverage - full details in FCC Output Pane Coverage collected when tests finish. RunInParallel option true for immediate See option RunMsCodeCoverage for a better (Beta) experience. View readme. Html report generation duration - 00:00:01.7879862 Generating html report Cobertura report generation duration - 00:00:01.0141168 Generating cobertura report Completed coverage for (Sample-Test1) : 00:00:04.3797661 Run OpenCover (Sample-Test1) File synchronization 23 items, duration : 00:00:00.1191535 Starting coverage - full details in FCC Output Pan e Coverage collected when tests finish. RunInParallel option true for immediate See option RunMsCodeCoverage for a better (Beta) experience. View readme.

tonyhallett commented 2 years ago

Set RunMsCodeCoverage to Yes.

roopahtshree commented 2 years ago

After setting RunMsCodeCoverage to Yes, i'm getting the below error. Please help to solve that error

Using automatically detected runsettings file(s). To learn more visit https://aka.ms/vs-runsettings. ========== Starting test run ========== Failed to negotiate protocol, waiting for response timed out after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout. Failed to negotiate protocol, waiting for response timed out after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout. ========== Test run aborted: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in < 1 ms ==========

tonyhallett commented 2 years ago

Please see https://github.com/FortuneN/FineCodeCoverage/issues/267#issuecomment-1137771373

tonyhallett commented 1 year ago

@roopahtshree Did you resolve your issue ?

roopahtshree commented 1 year ago

No, i tried setting the environment variable VSTEST_CONNECTION_TIMEOUT to 6000. Still the coverage is not getting generated

tonyhallett commented 1 year ago

Can you post your generated run settings from directoty \Debug\fine-code-coverage\coverage-tool-output

tonyhallett commented 1 year ago

Perhaps you can check this too https://learn.microsoft.com/en-us/visualstudio/test/troubleshooting-code-coverage?view=vs-2022

roopahtshree commented 1 year ago

Can we use fine code coverage to generate a coverage for C project having cunit test framework?

Attached is the runsettings generated Sample-Test1-fcc-mscodecoverage-generated.txt

tonyhallett commented 1 year ago

Can we use fine code coverage to generate a coverage for C project having cunit test framework?

I believe ms code coverage is C# or C++. Did you mean C++ ?

from https://learn.microsoft.com/en-us/visualstudio/test/writing-unit-tests-for-c-cpp?view=vs-2022 Visual Studio includes these C++ test frameworks with no additional downloads required:

Microsoft Unit Testing Framework for C++ Google Test Boost.Test CTest You can use the installed frameworks, or write your own test adapter for whatever framework you want to use within Visual Studio. A test adapter integrates unit tests with the Test Explorer window. Several third-party adapters are available on the Visual Studio Marketplace. For more information, see Install third-party unit test frameworks.

So cunit would need a test adapter.

roopahtshree commented 1 year ago

Thanks for the information.

Currently i'm using google test framework for which i have attached runsettings earlier.

tonyhallett commented 8 months ago

https://github.com/FortuneN/FineCodeCoverage/issues/219#issuecomment-1254636816

Hello, is it supporting branch coverage for C++, I tested it with VS2022 and the line coverage works well, but the branch coverage always shows 0.

Given that C++ worked for me ( admittedly on a very simple project ) and for the user above - closing as VSTEST_CONNECTION_TIMEOUT is a vstest issue and not FCC related.