View source: R/migrate-shinytest-dir.R
migrateShinytestDir | R Documentation |
This function migrates the old-style directory structure used by shinytest (versions 1.3.1 and below) to new test directory structure used in shinytest 1.4.0 and above.
migrateShinytestDir(appdir, dryrun = FALSE)
appdir |
A directory containing a Shiny application. |
dryrun |
If |
Before shinytest 1.4.0, the shinytest scripts and results were put in a
subdirectory of the application named tests/
. As of shinytest 1.4.0,
the tests are put in tests/shinytest/
, so that it works with the
runTests()
function shiny package (added in shiny 1.5.0).
With shinytest 1.3.1 and below, the tests/ subdirectory of the application was used specifically for shinytest, and could not be used for other types of tests. So the directory structure would look like this:
appdir/ `- tests `- mytest.R
In Shiny 1.5.0, the shiny::runTests()
function was added, and it will run
test scripts tests/ subdirectory of the application. This makes it possible
to use other testing systems in addition to shinytest. shinytest 1.4.0
is designed to work with this new directory structure. The directory
structure looks something like this:
appdir/ |- R |- tests |- shinytest.R |- shinytest | `- mytest.R |- testthat.R `- testthat `- test-script.R
This allows for tests using the shinytest package as well as other
testing tools, such as the shiny::testServer()
function, which can be used
for testing module and server logic, and for unit tests of functions in an R/
subdirectory.
In shinytest 1.4.0 and above, it defaults to creating the new directory structure.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.