migrateShinytestDir: Migrate legacy 'shinytest' files to new test directory...

Description Usage Arguments Details

View source: R/migrate-shinytest-dir.R

Description

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.

Usage

1
migrateShinytestDir(appdir, dryrun = FALSE)

Arguments

appdir

A directory containing a Shiny application.

dryrun

If TRUE, print out the changes that would be made, but don't actually do them.

Details

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:

1
2
3
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:

1
2
3
4
5
6
7
8
9
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.


shinytest documentation built on Sept. 14, 2021, 1:07 a.m.