test_package

0th

Percentile

Run all tests in an installed package

Test are run in an environment that inherits from the package's namespace environment, so that tests can access non-exported functions and variables. Tests should be placed in either inst/tests, or (better) tests/testthat.

Usage
test_package(package, filter = NULL, reporter = "summary", ...)

test_check(package, filter = NULL, reporter = "check", ...)

Arguments
package
package name
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".
reporter
reporter to use
...
Additional arguments passed to grepl to control filtering.
Value

  • the results as a "testthat_results" (list)

R CMD check

Use test_package to test an installed package, or in tests/test-all.R if you're using the older inst/tests convention.

If your tests live in tests/testthat (preferred) use test_check in tests/testthat.R. You still use test_package when testing the installed package.

Aliases
  • test_check
  • test_package
Examples
test_package("testthat")
Documentation reproduced from package testthat, version 0.1.1, License: GPL

Community examples

Looks like there are no examples yet.