How Can i do Code coverage with Google test framework

9,418 views
Skip to first unread message

Yashpal Soni

unread,
Aug 17, 2011, 4:30:09 AM8/17/11
to Google C++ Testing Framework
Hi,
Can you please tell me any inbuilt feature with google test to do code
coverage.
Or any other way to do code coverage after execution with google test.

Thanks & Regards,
Yashpal

Lior Friedman

unread,
Aug 17, 2011, 4:54:28 AM8/17/11
to Google C++ Testing Framework
Hi Yashpal,

googletest does not come with a build code coverage tool (that I know of).
you will need to use an external tool to gather code coverage data.

if you are working on windows using Visual Stuio, you should be able to use the VS coverage tools to do that.
on the up side, its free and it integrate quite nice with the development environment.
on the down side, it take some technical effort to use it.

of course there are other tools out there.

Lior

Dirk Meister

unread,
Aug 17, 2011, 5:06:01 AM8/17/11
to Yashpal Soni, Google C++ Testing Framework
Hello Yashpal,

google test has no built-in feature for code coverage.
As all tests are normal C++ programs, all code coverage tools work as usual. Code coverage tooling very much depends on the system (Windows, Linux) and the compiler.

The following blog article, features on the google test homepage, described how to use gcov together with the google test framework: http://meekrosoft.wordpress.com/2010/06/02/continuous-code-coverage-with-gcc-googletest-and-hudson/

Regards,
Dirk
Reply all
Reply to author
Forward
0 new messages