test

0th

Percentile

Execute test_that tests in a package.

test() is a shortcut for testthat::test_dir(), it runs all of a package's tests. test_file runs test() on the active file. test_coverage() computes test coverage for your package. It is a shortcut for covr::package_coverage() and covr::report(). test_coverage_file() computes test coverage for the active file. Is a shortcut for covr::file_coverage() and covr::report().

Usage
test(pkg = ".", filter = NULL, ...)

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

uses_testthat(pkg = ".")

test_file(file = find_active_file(), ...)

test_coverage_file(file = find_active_file(), filter = TRUE, show_report = interactive(), ...)

Arguments
pkg

package description, can be path or package name. See as.package() for more information

filter

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

...

additional arguments passed to testthat::test_dir() and covr::package_coverage()

show_report

Show the test coverage report.

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).

Aliases
  • test
  • test_coverage
  • uses_testthat
  • test_file
  • test_coverage_file
Documentation reproduced from package devtools, version 2.0.1, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.