Skip to contents

Measure coverage

Run code or tests and record which expressions were evaluated.

package_coverage()
Calculate test coverage for a package
file_coverage()
Calculate test coverage for sets of files
function_coverage()
Calculate test coverage for a specific function.
code_coverage()
Calculate coverage of code directly
environment_coverage()
Calculate coverage of an environment
with_coverage()
Calculate coverage of arbitrary code run against an environment
current_coverage()
Coverage measured so far in the current process
shiny_app_coverage()
Calculate test coverage for a Shiny app
covr covr-package
covr: Test coverage for packages
in_covr()
Determine if code is being run in covr

Inspect and combine results

coverage
Coverage objects
print(<coverage>)
Print a coverage object
c(<coverage>)
Combine coverage objects
as.data.frame(<coverage>)
Convert a coverage object to a data frame
percent_coverage()
Provide percent coverage of package
tally_coverage()
Tally coverage by line, expression, function or branch
tally_tests()
Tally which tests ran each line
zero_coverage()
Provide locations of zero coverage
value()
Retrieve the execution counts from a coverage object
display_name()
The source file of each trace
annotate_coverage()
Annotate source code with line and branch coverage

Reports

report()
Display covr results using a standalone report
report_html()
A coverage report to include in other documents
file_report() file_report_html()
A coverage report for a specific file
coverage_to_markdown()
Convert a coverage dataset to a markdown table
coverage_to_list()
Convert a coverage dataset to a list
colorblind_palette
Colors for color vision deficiency

Export formats

cobertura()
Create a Cobertura XML file
lcov()
Create an LCOV tracefile
sonarqube()
Create a SonarQube Generic XML file
badge()
Create a coverage badge

CI services

codecov()
Run covr on a package and upload the result to codecov.io
coveralls()
Run covr on a package and upload the result to coveralls
gitlab()
Run covr on package and create report for GitLab

Options and exclusions

exclusions
Exclusions
covr.branch_coverage
Branch coverage
covr.record_tests
Record Test Traces During Coverage Execution

Deprecated

to_cobertura() to_sonarqube()
Deprecated functions