RStudio addins for several common testing-related tasks during package development, such as switching between a source file and an associated test file, or running unit tests in a single test file (hotkeyable in RStudio!). testthis also provides utility function to manage tests in subdirectories of the test/testthis directory.
For details please refer to the README
Testthis uses usethis::proj_get()
to detect project root of the current
working directory. You can override the project root with
usethis::proj_set()
.
Package options can be set with options()
. You can add options()
to
your .Rprofile
to make them permanent across sessions.
testthis.sep
Default separator to use when creating test files with
test_skeleton()
. Defaults to _
, must be either _
or -
; i.e whether
you want your files to be named test_foofunction.R
or test-foofunction.R
testthis.integration_tests_path
, testthis.acceptance_tests_path
,
testthis.manual_tests_path
Default paths used by the functions
testthis::use_integration_tests()
, testthis::test_integration()
, etc...
test_this tags are special comments that modify the behaviour of the
functions supplied by this package. They are of the form #* @tag <value>
.
Please not that only some test_this tags really require a <value>
.
Valid tags for script files in the /R/ dir (pkg/R/*.R
)
@testfile <filename>
: manually specify associated test file. Should
usually start with test_
. This is used by test_this()
, lest_this()
and
open_testfile()
.
Valid tags or test files (pkg/tests/testthat/test_*.R
)
@testing <functionname>
: mark functionname
as tested.
Should usually go next the associated test_that()
call. This is used by
test_coverage()
.