The tests that will be run are all those in the test
subdirectory
of the root of the syberia engine, unless otherwise specified.
test_engine(engine = syberia_engine(), base = "test", config = file.path("config", "environments", "test"), ignored_tests = ignored_tests_from_config(engine, base, config), optional_tests = optional_tests_from_config(engine, base, config), required = TRUE, reporter = c("summary", "check", "list", "minimal", "multi", "rstudio", "silent", "stop", "tap", "teamcity")[1L], error_on_failure = TRUE)
engine | syberia_engine. The syberia engine to test.
If a |
---|---|
base | character. Any subdirectory to test specifically. By default,
|
config | character. The relative path to the configuration resource,
by default |
ignored_tests | character. The list of tests to ignore, by default
the local variable |
optional_tests | character. The list of tests to ignore, by default
the local variable |
required | logical. Whether or not all tests are required to have resources,
by default |
reporter | character. The testthat package test reporter to use. The
options are |
error_on_failure | logical. Whether or not to raise an error
if there are any failures. By default, |
A list of testthat_results
objects giving the details for
the tests executed on each tested resource. If error_on_failure
is TRUE
, error instead if there are any failures.
It is possible to introduce additional behavior prior to and after tests. This can be used to perform additional testing not covered by sourcing all files in the "test/" directory of the syberia engine.
To provide a setup or teardown hook, simply place a function or list of
functions in a local variable setup
or teardown
, respectively,
in config/environments/test
relative to the root of the syberia engine,
or pass the relevant setup
or teardown
parameters to this function.
For example, creating a file config/environments/test.R
with the code
setup <- function(env) cat("Running all tests.")
will print a message
before all the tests are run. The one parameter the function must take is an
environment which will contain a single key, director
, pointing to the
object returned by calling syberia_engine
.