CodeCoverage » History » Revision 7
« Previous |
Revision 7/8
(diff)
| Next »
Davide Pesavento, 10/11/2016 03:35 AM
Fix formatting; delete obsolete example
Code Coverage¶
This guide has instructions to generate code coverage report on your local machine in HTML or plain text.
Install required command-line tool (gcovr) and configure the project to generate temporary profiling files:¶
Install
gcovr
on your machine:sudo easy_install gcovr
When configuring, add option "--with-coverage" (e.g.,
./waf configure --with-tests --with-coverage
). If the build or running unit tests requires other packages, all the packages should be configured with the option "--with-coverage".
To create code coverage report in HTML format, follow these steps:¶
After building the project and running unit tests, use
gcovr
to generate detailed code coverage report in html format. The following is a one-liner:
mkdir build/coverage; gcovr -r . --object-directory=build --html --html-details -o build/coverage/coverage.html
Use any browser to open
build/coverage/coverage.html
to see the code coverage report.
To create code coverage report in plain text format, follow these steps:¶
After building the project and running unit tests, use
gcovr
to generate detailed code coverage report in plain text. The command is:
gcovr -r . --object-directory=build --html-details -o build/coverage.txt
Use any plain text editor/reader to open
build/coverage.txt
to see the code coverage report.
To view the detailed code coverage report on Jenkins for builds triggered by Gerrit¶
Click on the build link that Jenkins posted as a comment on Gerrit.
Click on the label "code-coverage" under "Configurations".
Click on "Cobertura Coverage Report" to see the detailed code coverage report for the build.
Updated by Davide Pesavento about 8 years ago · 7 revisions