exampletestr
is for creating shells (skeletons) of testthat
unit test files based on the examples in a package’s documentation. When these tests are completed, they will ensure that the examples function correctly and form a valuable part of your unit test suite. I have often (but not always) found that I test my functions manually by making sure my examples work as intended, so why not use these as a basis for proper unit testing?
You can install the released version of exampletestr from CRAN with:
install.packages("exampletestr")
You can install the released version of exampletestr from GitHub with:
remotes::install_github("rorynolan/exampletestr")
exampletestr
There are three ways to use exampletestr
to make unit test shells based on function examples:
roxytest
)..R
file at a time.These three articles should be read in order to learn how the package works and how to use it.
I would like to stress that whilst unit testing should be automatic, the creation of these tests is a manual process, a manual check. This package is supposed to help you to start making those tests. It is not supposed to create fully functioning tests automatically, nor can it help you to write every type of test you might want.