How can I get code coverage using gtest on Windows?

Rasmi Ranjan Nayak picture Rasmi Ranjan Nayak · Aug 19, 2013 · Viewed 13.4k times · Source

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

Answer

OpenCppCoverage picture OpenCppCoverage · Aug 24, 2014

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.