FineCodeCoverage icon indicating copy to clipboard operation
FineCodeCoverage copied to clipboard

Fine code coverage is not visible

Open roopahtshree opened this issue 3 years ago • 3 comments

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.

roopahtshree avatar Aug 30 '22 12:08 roopahtshree

Set RunMsCodeCoverage to Yes.

tonyhallett avatar Aug 30 '22 13:08 tonyhallett

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 ==========

roopahtshree avatar Sep 01 '22 06:09 roopahtshree

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

tonyhallett avatar Sep 02 '22 07:09 tonyhallett

@roopahtshree Did you resolve your issue ?

tonyhallett avatar Sep 22 '22 15:09 tonyhallett

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

roopahtshree avatar Sep 22 '22 15:09 roopahtshree

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

tonyhallett avatar Sep 22 '22 19:09 tonyhallett

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

tonyhallett avatar Sep 22 '22 19:09 tonyhallett

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

roopahtshree avatar Sep 23 '22 05:09 roopahtshree

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.

tonyhallett avatar Sep 23 '22 08:09 tonyhallett

Thanks for the information.

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

roopahtshree avatar Sep 23 '22 08:09 roopahtshree

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.

tonyhallett avatar Jan 14 '24 20:01 tonyhallett