Code Coverage for Visual Studio 2017 Community with C++ - c++

Are there any plugins for visual studio 2017 which enable to calculate unit test code coverage with C++?
I only found
OpenCppCoverage:
https://marketplace.visualstudio.com/items?itemName=OpenCppCoverage.OpenCppCoveragePlugin
but it seems to be outdated / not working.
Other than that it seems like there are only Code coverage plugins for .Net-Languages but not C++
Are there any other options (besides upgrading to MSVC Enterprise)

I recently tested CPPCoverage, an open source and free extension that works perfectly to perform code coverage of native Visual C++ unit tests.
It is a visual extension (VSIX) and provide details reports. Once installed, Right-click in solution explorer on the test or application project and click "Run code coverage".

Related

How to get CodeCoverage of tests running on VS2017 Professional Version 15.9.8?

I want to find code coverage for methods in dlls to be tested.
Through https://learn.microsoft.com/en-us/visualstudio/test/using-code-coverage-to-determine-how-much-code-is-being-tested?view=vs-2017#requirements I understand that there should be menu for CodeCoverage in Test Explorer for VS2017. which I didin't find for my installed visual studio..
So what is process to find code coverage for VS 2017 professional version 15.8
Code coverage is a Enterprise feature that is not available for Professional version.
Duplicate of question "Analyze Code Coverage" option missing in Visual Studio 2017 Professional
See version feature comparison here https://visualstudio.microsoft.com/vs/compare/

Does Visual Studio Code C++ Unit Test coverage?

We have a C++ project we're developing on Linux with gcc. We'd like to use Visual Studio Code--if we can ever get it configured properly--but we can't if it won't meet our needs.
Does Visual Studio Code show C++ unit test coverage? For example, like how Eclipse shows code coverage of JUnit tests? Can it even be configured to run unit tests with Google Test, for example?
Code coverage reports seems to be available only in real Visual Studio Enterprise edition. For VS Code you can only utilize some command line utils, such as gcov.
Here's a link to Gcov Viewer plugin for vscode. that
uses the output from gcc to Highlight the covered lines. and automate usage of e gcov .

Code Coverage Reporting with Visual Studio 2013 Professional for native C++

Using the C++ unit testing framework with Visual Studio 2013 Professional, one can write unit tests and run them from within the IDE, but in order to generate any coverage reports, apparently, one needs to have the Premium or Ultimate edition of Visual Studio.
Is it possible to get code coverage reports with the Professional edition, preferably without installing any third party tools? If not, what alternate options exist for people who are not using the more expensive editions of the IDE?
Please note that it's possible to generate the coverage data by using command line tools, but I am unable to find a way to look at the results. For the sake of reference, here are the steps for command line generation of the coverage statistics:
Build the code to test with with /PROFILE linker switch
Run vsinstr /coverage <binaryName> to instrument the code; make sure that you are inside VS 2013 command prompt
Run start vsperfmon -coverage -output:results to run the profiler
Run your unit tests
Stop the profiler by running vsperfcmd -shutdown
The above will give you a results.coverage file, with no way to view it without the Premium or Ultimate editions as far as I know.
With VS2013 Professional you are out of luck if you want to do it without third party tools Requirements: Visual Studio Ultimate, Visual Studio Premium (http://msdn.microsoft.com/en-us/library/dd537628.aspx). From what I understand you already managed to generate your *.coverage file and you are having problems opening it. Visual Coverage (https://github.com/jsargiot/visual-coverage) tool can help you with that, its very simple to use and it is opensource. If you would like to find more alternatives, see another SO thread: Viewing Code Coverage Results outside of Visual studio. The tools are meant for C# coverage files but from what I understand there should not be any difference.
If you are ready to use third-party libraries, you can use OpenCPPCoverage. It works for me like a command line app. But I couldn't run it like a visual studio plugin at Professional Visual Studio 2013.
One possible way you could get coverage data is by running an instrumentation toolkit on your Unit Test program. The instrumentation tool will tell you how much was covered during execution and you can easily relate this data back to how much coverage your unit tests give you. I did this with an XCode project and OpenPAT but you could do the same with any Visual Studio friendly toolkit.

Cucumber js in visual studio 2013

Is there a project with similar goals as Specflow is to cucumber in Visual Studio, but for cucumberjs?
I'm considering a unit testing / bdd framework for Visual Studio. Cucumberjs seems like the obvious choice as I am using Specflow to test the c#. However cucumberjs requires nodejs to be installed.
Chutzpah runs things like jasmine, qunit etc in Visual Studio. Is there a way to do the same for cucumberjs? Perhaps nodejstools for visualstudio with a mixture of something else?
There is a Feature request: Cucumber-js support for Chutzpah, but it's work in progress.
(Chutzpah was moved to github, so the issue was lost)
A new Chutzpah feature request on github for cucumber-js support
There is an interview with a cucumber core member saying (below) which sounds promising:
"Support for Cucumber.js is being added to popular IDEs like Jetbrains
Webstorm 8 and Visual Studio."
As per David Leitner's reply, I've created a step-by-step guide to setting up cucumberjs in Visual Studio.
http://blogs.endjin.com/2015/10/step-by-step-guide-to-setting-up-cucumberjs-in-visual-studio-2015/
I've done this by using the Visual Studio Task Runner Explorer. (You have to add it if you use VS 2013, with 2015 it's already included.)
This Extension is a task runner for Grunt and Gulp directly within Visual Studio 2013. It is now possible to define a Grunt task, like this one which runs your cucumberjs Features.

How do I set up code coverage in C++ googletest project in Visual Studio 2010

I have a C++ googletest project building in Visual Studio 2010 professional. This builds a console application which generates XML test result output. How can I set it up to get code coverage information?
I have tried instructions here to instrument the code but viewing the Code Coverage results seems to require Visual Studio Ultimate. Is there any converter for the .coverage files Visual Studio generates?
Bonus points for portable/free/open-source solutions!
You can try OpenCppCoverage: http://opencppcoverage.codeplex.com.
OpenCppCoverage is a code coverage tools for C++ under Windows. It is open-source and works well with google test / Visual Studio C++.
Disclaimer: I am the author of this tool.
Hope that help.
Edit to follow brasofilo advice:
To be more precise about your question, OpenCppCoverage should work with Visual Studio C++ 2010 professional. The only requirement is to support native Pdb files (http://msdn.microsoft.com/en-us/library/yd4f8bd1%28vs.71%29.aspx).
It is open source and free and you can find sources here: https://opencppcoverage.codeplex.com/SourceControl/latest.
What do you mean by portable?
If you mean "Multi platform" -> No, it works only on Windows
If you mean "Portable application" (http://en.wikipedia.org/wiki/Portable_application): OpenCppCoverage required only Redistributable for Visual Studio 2013 to be installed on host (http://www.microsoft.com/en-US/download/details.aspx?id=40784) but it does not write to registry and you can move the binaries where you want (usb key for example).
Hope that help.
I think you can use the VSTEST.Consol.exe for this purpose http://msdn.microsoft.com/en-us/library/vstudio/jj155796.aspx.
According to documentation, it would run tests written against any test framework. You may enable the
/Enablecodecoverage option, which Enables data diagnostic adapter CodeCoverage in the test run.
More information may be found here: http://blogs.msdn.com/b/bhuvaneshwari/archive/2012/06/16/vstest-console-exe-commandline-test-runner.aspx
There is also an open source code coverage tool called ggcov: http://ggcov.sourceforge.net/index.html
Hope that these helps.