test | R Documentation |
It runs tests from specifications in .feature
files found in the path
.
To run Cucumber tests alongside testthat
tests, see cucumber::run()
.
test(
path = "tests/acceptance",
filter = NULL,
reporter = NULL,
env = NULL,
load_helpers = TRUE,
stop_on_failure = TRUE,
stop_on_warning = FALSE,
...
)
path |
Path to directory containing tests. |
filter |
If not NULL, only features with file names matching this regular expression will be executed. Matching is performed on the file name after it's stripped of ".feature". |
reporter |
Reporter to use to summarise output. Can be supplied
as a string (e.g. "summary") or as an R6 object
(e.g. See Reporter for more details and a list of built-in reporters. |
env |
Environment in which to execute the tests. Expert use only. |
load_helpers |
Source helper files before running the tests? |
stop_on_failure |
If |
stop_on_warning |
If |
... |
Additional arguments passed to |
Use a separate directory for your acceptance tests, e.g. tests/acceptance
.
It's not prohibited to use tests/testthat
directory, but it's not recommended as those tests
serve a different purpose and are better run separately, especially if acceptance tests take
longer to run than unit tests.
If you want to run Cucumber tests alongside testthat
tests, you can use cucumber::run()
in one of the test-*.R
files in your tests/testthat
directory.
Use setup-*.R
files for calling step()
, define_parameter_type()
and hook()
to leverage testthat loading mechanism.
If your step()
, define_parameter_type()
and hook()
are called from somewhere else, you are responsible for loading them.
Read more about testthat special files in the testthat documentation.
Use test-*.R
files to test the support code you might have implemented that is used to run Cucumber tests.
Those tests won't be run when calling test()
. To run those tests use
testthat::test_dir("tests/acceptance")
.
## Not run:
cucumber::test("tests/acceptance")
cucumber::test("tests/acceptance", filter = "addition|multiplication")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.