use_shinytest2 | R Documentation |
Use shinytest2 with your Shiny application
use_shinytest2(
app_dir = ".",
runner = missing_arg(),
setup = missing_arg(),
ignore = missing_arg(),
package = missing_arg(),
...,
quiet = FALSE,
overwrite = FALSE
)
use_shinytest2_test(
app_dir = ".",
open = rlang::is_interactive(),
quiet = FALSE,
overwrite = FALSE
)
app_dir |
The base directory for the Shiny application |
runner |
If |
setup |
If |
ignore |
If |
package |
If |
... |
Must be empty. Allows for parameter expansion. |
quiet |
If |
overwrite |
If |
open |
If |
use_shinytest2()
: This usethis-style method initializes many different useful features when using
shinytest2:
runner
: Creates a shinytest2 test runner at ./tests/testthat.R
. This file
will contain a call to test_app()
.
setup
: Creates ./tests/testthat/setup-shinytest2.R
to add your Shiny ./R
objects and functions into the testing environment. This file will run before testing begins.
ignore
: Add an entry to ./Rbuildignore
(if it exists) and .gitignore
to ignore new debug screenshots. (*_.new.png
)
package
: Adds shinytest
to the Suggests
packages in the DESCRIPTION
file (if it exists).
If any of these values are not missing, the remaining missing values will be set to FALSE
. This allows use_shinytest2()
to add more flags in future versions without opting into all changes inadvertently.
use_shinytest2_test()
: Creates a test file called ./tests/testthat/test-shinytest2.R
. By
default, this file's template test will initialize your Shiny application and
expect the initial values.
This method will also set up a test runner if it does not exist.
# Set up shinytest2 testing configs
## Not run: use_shinytest2()
# Set up a shinytest2 test
## Not run: use_shinytest2_test()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.