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)
syberia_engine. The syberia engine to test.
If a character
, it will be passed to syberia_engine
first.
character. Any subdirectory to test specifically. By default,
"test"
.
character. The relative path to the configuration resource,
by default "config/environments/test"
.
character. The list of tests to ignore, by default
the local variable ignored_tests
extracted from the configuration
resource specific by the config
parameter.
character. The list of tests to ignore, by default
the local variable optional_tests
extracted from the configuration
resource specific by the config
parameter.
logical. Whether or not all tests are required to have resources,
by default TRUE
. If TRUE
, the ignored_tests
resources will not be required to have an accompanying test. It is highly
recommended that all your projects have full test coverage.
character. The testthat package test reporter to use. The
options are c("check", "list", "summary", "minimal", "multi", "rstudio",
"silent", "stop", "tap", "teamcity")
, with the default being "summary"
.
logical. Whether or not to raise an error
if there are any failures. By default, TRUE
.
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
.