powered by
There are two helper functions:
use_testthat() sets up overall testing infrastructure: creates tests/testthat/, tests/testthat.R, and adds testthat to Suggests.
use_testthat()
tests/testthat/
tests/testthat.R
use_test() sets up individual test files: creates tests/testthat/test-<name>.R and, optionally, opens it for editing.
use_test()
tests/testthat/test-<name>.R
use_testthat()use_test(name = NULL, open = interactive())
use_test(name = NULL, open = interactive())
Base of test file name. If NULL, and you're using RStudio, will be based on the name of the file open in the source editor.
NULL
Open the newly created file for editing? Happens in RStudio, if applicable, or via utils::file.edit() otherwise.
utils::file.edit()
The testing chapter of R Packages.
# NOT RUN { use_testthat() use_test() use_test("something-management") # }
Run the code above in your browser using DataLab