Unit testing in R for Sheffield R User Group
These are my notes on unit testing in R developed for the Sheffield R User Group on 6 March 2018.
We need to install a few packages to perform tests and check test coverage.
usethis makes the setup easier.
install.packages(c("usethis", "testthat", "covr"))
usethis expects your project to behave like a package, so we should add a
Then set up our testing framework:
We won’t be automating these checks with continuous integration or test coverage services because:
If you do want to set this up you need to:
codecov.ioare free for open source projects, and
codecov.ioallows you to test coverage for one private github repo.
Now you’re set up you can clone or download this repo (download and extract the repo if you don’t know what this means) and follow the examples in