Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

test

Execute testthat tests in a package


Description

Usage

test(pkg = ".", filter = NULL, stop_on_failure = FALSE, export_all = TRUE, ...)

test_active_file(file = find_active_file(), ...)

test_coverage(pkg = ".", show_report = interactive(), ...)

test_coverage_active_file(
  file = find_active_file(),
  filter = TRUE,
  show_report = interactive(),
  export_all = TRUE,
  ...
)

Arguments

pkg

The package to use, can be a file path to the package or a package object. See as.package() for more information.

filter

If not NULL, only tests with file names matching this regular expression will be executed. Matching is performed on the file name after it's stripped of "test-" and ".R".

stop_on_failure

If TRUE, throw an error if any tests fail.

export_all

If TRUE (the default), export all objects. If FALSE, export only the objects that are listed as exports in the NAMESPACE file.

...

additional arguments passed to wrapped functions.

file

One or more source or test files. If a source file the corresponding test file will be run. The default is to use the active file in RStudio (if available).

show_report

Show the test coverage report.


devtools

Tools to Make Developing R Packages Easier

v2.4.1
MIT + file LICENSE
Authors
Hadley Wickham [aut], Jim Hester [aut, cre], Winston Chang [aut], RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.