ClevelandClinicQHS / riskcalc

An R package for building risk calculators
https://clevelandclinicqhs.github.io/riskcalc/
Other
2 stars 0 forks source link

Add test coverage #5

Closed zajichek closed 1 year ago

zajichek commented 1 year ago

Use GitHub Actions to automate testing workflow and display badge on README with https://covr.r-lib.org/

Following this: https://r-pkgs.org/testing-design.html#sec-testing-design-coverage

zajichek commented 1 year ago

The functions devtools::test_coverage_active_file() and devtools::test_coverage() provide test coverage summaries for the current file open or the entire package. Gives a useful summary:

image

Running this to setup workflow: usethis::use_github_action("test-coverage"), which created a yaml file in .github/workflows.

Add the badge to README with:

use_github_actions_badge("test-coverage") # Adds code coverage to README
build_readme()
zajichek commented 1 year ago

After pushing the last commit, the workflow ran (to complete the testing suite), and shows that we are passing based on the current source code.

image