Load the source package and run the selected generated test with testthat.
Helpers, setup and teardown are loaded from that case's suite. Regenerate
with roxygen2::roxygenise() after changing its declaration.
Selecting a case requires testthat 3.3.0 or newer.
Testthat runs in a temporary package copy so the original snapshots stay
intact. Use a full suite run to review or update snapshots and exercise
custom suite runners. The copy requires ordinary files and directories,
as in check_generated_tests().
The package code is loaded from path in the current R session. pkgload
can load code excluded by .Rbuildignore. Tests, helpers and fixtures run
from the copy. To also load the package code from the filtered copy in an
isolated process with a timeout, use run_test_plan() with the case ID.
Usage
run_test_case(
id,
path = ".",
reporter = "summary",
download_fixtures = FALSE,
fixture_cache = NULL
)Arguments
- id
An exact case ID from
test_case_plan().- path
Path to the source package root.
- reporter
A testthat reporter name or object.
- download_fixtures
Allow HTTPS downloads of declared fixtures when a verified copy is unavailable in the cache. Defaults to
FALSE.- fixture_cache
BiocFileCache directory.
NULLuses the package's user cache directory,tools::R_user_dir("biocroxytest", "cache").
Examples
if (interactive()) run_test_case("arithmetic/small")
