use_testthat

0th

Percentile

Create tests

There are two helper functions:

  • use_testthat() sets up overall testing infrastructure: creates tests/testthat/, tests/testthat.R, and adds testthat to Suggests.

  • use_test() sets up individual test files: creates tests/testthat/test-<name>.R and, optionally, opens it for editing.

Usage
use_testthat()

use_test(name = NULL, open = interactive())

Arguments
name

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.

open

Open the newly created file for editing? Happens in RStudio, if applicable, or via utils::file.edit() otherwise.

See Also

The testing chapter of R Packages.

Aliases
  • use_testthat
  • use_test
Examples
# NOT RUN {
use_testthat()

use_test()

use_test("something-management")
# }
Documentation reproduced from package usethis, version 1.5.1, License: GPL-3

Community examples

Looks like there are no examples yet.