Has anyone ever used gtest with visual studio? if so, how did you get code coverage reports? I'd like to configure my project to produce coverage data, but it seems like nobody else uses gtest/visual studio with gcov or any other code coverage.
Once we run the test method, While the unit test is passing, we need to check if our unit test covers the all code block for our method using the “Code Coverage”. Once the test execution successful, Visual Studio calculate the code coverage and display it within “Code Coverage Results” windows; as shown in below image.
Ctrl+U D commands. You can use this command to run coverage analysis of unit tests from the editor, from the Solution Explorer, or from unit tests sessions.
I asked around the office, and someone suggested this tool: https://github.com/OpenCppCoverage/OpenCppCoverage
I will give it a try. I will come back and report the results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With