knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Why use covrpage when developing a package?

Trust is earned not ~~inherited~~ importedFrom. Now that you've built a cool package, you want potential users to trust it so that they might adopt it. How to build trust in your piece of software? Unit testing is part of the components building trustworthiness of your package. Imagine you're at the point where you've tested most lines of your code with thorough assertions, including checks of edge cases. Proof of that hard work will be a high test coverage, that potential users of your package might notice thanks to a bright green coverage badge. But how would they know your tests are thorough? That's what covrpage helps you with, by creating a summary report of your tests that goes beyond the coverage percentage. This way, potential users can see at a glance how good the unit testing of your package is.

Why use covrpage on top of say Codecov and Coveralls?

The coverage badge provided by coverage services displays only the percentage of lines covered by tests, but is also clickable, providing access to a nifty report. covrpage report for your package helps with two potential limitations of such reports:

Is covrpage report only for users?

No, it can also inform your work on your package, by helping you track progress of the unit tests you're working on, and it can show to potential contributors where help is needed.

How is covrpage report built?

To see how covrpagereport looks like, the easiest thing to do is to run covrpage::covrpage() at the root of your package, or providing the path to your package as argument.

The functions powering the report are:

You can see an example for the remedy package here.

This vignette is a guide how to read and leverage the report for both end users and polished developers. In addition you can read Tests Results Indicators to learn what visual cues covrpage gives to indicate statuses of tests both as badges and throughout the report itself.

Note that the different covrpage utilities functions mentioned above can be useful on their own whilst developing a package, or say, inspecting a new test file added by a collaborator in a PR.

How to publish covrpage report?

There are two places where you can keep covrpage report, and it's advised to use both since they will get seen by different readers:

In both cases, you can also ensure the report stays up-to-date by having it deployed from Travis every time you push to your repository.

The easiest solution is to run travis::use_tic() at the root of your repository, which will ensure your pkgdown website is deployed from Travis if you have one.

For a detailed explanation on using covrpage with tic or more low level ways to use covrpage with travis ci you can read in the Continuous Integration vignette.

Conclusion

covrpage report aims at providing more information about the testing of your package to potential users and collaborators, and can inform your own work developing and maintaining your package. Publishing the report with continuous integration will ensure it's always up-to-date. As a summary, in any package of yours, run

# remotes::install_github('ropenscilabs/travis')
# travis::use_tic()
covrpage::use_covrpage(travis_type = 'tic')
covrpage::covrpage(vignette = TRUE)


metrumresearchgroup/covrpage documentation built on Feb. 25, 2023, 2:22 p.m.