use_test_subdir {testthis} | R Documentation |
Use test subdirectories
Description
Create a subdir in ‘tests/testthat/’ and optionally an R script
containing a helper function to run all tests in that subdir. Useful for
separating long-running tests from your unit tests, or storing tests that
you do not want to run on CRAN or during R CMD Check. For running tests in
‘tests/testthat/’ subdirectories see test_subdir()
.
Usage
use_test_subdir(path, make_tester = TRUE, ignore_tester = TRUE)
use_integration_tests()
use_acceptance_tests()
use_manual_tests()
Arguments
path |
|
make_tester |
|
ignore_tester |
|
Value
TRUE
on success (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
Other infrastructure:
use_testdata()
,
use_tester()
Examples
## Not run:
use_test_subdir("special_tests", make_tester = TRUE)
## Reload the Package manually...
## Create some tests in tests/testthat/test_special_tests/
test_special_tests()
## End(Not run)