google-test: code coverage

点点圈 提交于 2019-11-30 02:56:26
chalup

Yes, I've successfully used both free (gcov) and commercial (CTC++) tools. No special steps are needed, just follow the documentation.

More details can be found in this blog http://googletesting.blogspot.dk/2014/07/measuring-coverage-at-google.html

Yes, You can club your Gtest Based application with support of Gcov/lcov. refer the documentation of lcov http://ltp.sourceforge.net/coverage/lcov.php

there is one linux test project utility available which does your job very easy and is very self-interpretative.

lcov - a graphical GCOV front-end

Download from Ubuntu repo:

$ sudo apt-get install lcov
  1. Use following commands in your build directory

    $ lcov --directory ./build/ --capture --output-file ./code_coverage.info -rc lcov_branch_coverage=1
    
  2. Run the Application

  3. Generate HTML Report

    $ genhtml code_coverage.info --branch-coverage --output-directory ./code_coverage_report/
    

This will look something like - http://ltp.sourceforge.net/coverage/lcov/output/index.html

(Only works on Windows)

It seems this question is still active, so here's an additional option. I've just tested Google Tests on our code coverage solution (yes, I'm the author), which works on Visual Studio. The project can be found at: https://github.com/atlaste/CPPCoverage

Instructions: right-click project, run coverage. :-)

If you prefer an XML output (for CI), you can call the coverage executable manually.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!