testthis {testthis} | R Documentation |
Testthis-package
Description
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.
Details
For details please refer to the README
Setting the project path
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
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 namedtest_foofunction.R
ortest-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...
Testthis Tags
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 withtest_
. This is used bytest_this()
,lest_this()
andopen_testfile()
.
Valid tags or test files (pkg/tests/testthat/test_*.R
)
-
@testing <functionname>
: markfunctionname
as tested. Should usually go next the associatedtest_that()
call. This is used bytest_coverage()
.
Author(s)
Maintainer: Stefan Fleck stefan.b.fleck@gmail.com (ORCID)