Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get code coverage using gtest on Windows?

Tags:

I am using gtest for testing my code in C++ with Visual studio 2010. But I could not able to makeout that I have reached 100% code coverage. To make sure that I have covered 100% code coverage, I would like to know that, is there any way to find out the code coverage gtest or not? Because I have Googled a lot but I did not find any possible way to get the code coverage result by using gtest in Windows enviornment. If it is possible please let me know.

Thanks A Lot..

like image 946
Rasmi Ranjan Nayak Avatar asked Aug 19 '13 06:08

Rasmi Ranjan Nayak


People also ask

How do I display code coverage?

On the Test menu, select Analyze Code Coverage for All Tests. You can also run code coverage from the Test Explorer tool window. Show Code Coverage Coloring in the Code Coverage Results window. By default, code that is covered by tests is highlighted in light blue.

Which tool is used for code coverage?

Code coverage tools are available for many programming languages and as part of many popular QA tools. They are integrated with build tools like Ant, Maven, and Gradle, with CI tools like Jenkins, project management tools like Jira, and a host of other tools that make up the software development toolset.


1 Answers

You can try OpenCppCoverage: https://github.com/OpenCppCoverage/OpenCppCoverage.

It is open source, designed for Visual Studio C++ and works well with Google Test. I already used successfully for mid size project (~500 000 lines of code).

Hope that help.

Disclaimer: I am the author of the tool.

like image 62
OpenCppCoverage Avatar answered Jan 19 '23 19:01

OpenCppCoverage