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

Fine code coverage is not visible #289

Closed
roopahtshree opened this issue Aug 30, 2022 · 11 comments
Closed

Fine code coverage is not visible #289

roopahtshree opened this issue Aug 30, 2022 · 11 comments

Comments

@roopahtshree
Copy link

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
Copy link
Collaborator

Set RunMsCodeCoverage to Yes.

@roopahtshree
Copy link
Author

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
Copy link
Collaborator

Please see #267 (comment)

@tonyhallett
Copy link
Collaborator

@roopahtshree
Did you resolve your issue ?

@roopahtshree
Copy link
Author

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

@tonyhallett
Copy link
Collaborator

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

@tonyhallett
Copy link
Collaborator

@roopahtshree
Copy link
Author

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
Copy link
Collaborator

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
Copy link
Author

Thanks for the information.

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

@tonyhallett
Copy link
Collaborator

#219 (comment)

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.

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

No branches or pull requests

2 participants