This is a simple wrapper for devtools::test(), but rather than running the tests in inst/tests/ or tests/testthat/, it runs the tests in a subdirectory of that folder. For creating such subdirectories, please also see use_test_subdir().

test_subdir(subdir, ...)

test_integration(...)

test_acceptance(...)

test_manual(...)

test_all(...)

Arguments

subdir

character scalar. subdir of inst/tests/ or tests/testthat that contains the tests

...

passed on to devtools::test()

Value

A testthat::testthat_results object (invisibly)

Test subdirectory presets

Three preset test subdirs are defined at the moment:

test_integration()

Integration tests, also called component tests. Put tests here that test if several functions / parts of your program work together as expected. You can create the relevant subdir testthat/integration_tests/ with use_integration_tests().

test_acceptance()

Acceptance tests. This is the highest levels of tests. Put tests here that verifies if your package fulfills the goals/requirements you set out to achieve with your package were met. You can create the relevant subdir testthat/acceptance_tests/ with use_acceptance_tests().

test_manual()

Manual tests. Put tests here that produce output that has to be manually verified, such as: console output, pdf files, plots. It is recommended you collect the output files of such tests in tests/testthat/testout. You can create the relevant subdir with testthat/manual_tests/ with use_manual_tests().

You can modify the default paths for manual, acceptance and integration tests by setting the respective options(), but it is recommended to create your own test subdirs instead.

See also