run group(s) of unit tests for EJAM package run tests of local source pkg EJAM, by group of functions, quietly, interactively or not, with compact summary of test results
Source:R/test_ejam.R
test_ejam.Rdrun group(s) of unit tests for EJAM package run tests of local source pkg EJAM, by group of functions, quietly, interactively or not, with compact summary of test results
Usage
test_ejam(
ask = TRUE,
noquestions = TRUE,
useloadall = TRUE,
y_skipbasic = TRUE,
y_latlon = TRUE,
y_shp = TRUE,
y_fips = TRUE,
y_coverage_check = FALSE,
y_runall = TRUE,
y_runsome = FALSE,
run_these = NULL,
skip_these = c("live_url", "live_api", "local_api"),
y_stopif = FALSE,
y_seeresults = TRUE,
y_save = TRUE,
y_tempdir = TRUE,
mydir = NULL
)Arguments
- ask
logical, whether it should ask in RStudio what parameter values to use
- noquestions
logical, whether to avoid questions later on about where to save shapefiles
- useloadall
logical, TRUE means use
pkgload::load_all(), FALSE means uselibrary(). But useloadall = TRUE is essential actually, for unexported functions to be found when they are tested!- y_skipbasic
logical, if FALSE, runs some basic
ejamit()functions, but NOT any unit tests.- y_latlon
logical, if y_skipbasic = FALSE, whether to run the basic
ejamit()using points- y_shp
logical, if y_skipbasic = FALSE, whether to run the basic
ejamit()using shapefile- y_fips
logical, if y_skipbasic = FALSE, whether to run the basic
ejamit()using FIPS- y_coverage_check
logical, whether to show simple lists of which functions might not have unit tests, just based on matching source file and test file names.
- y_runall
logical, whether to run all tests instead of only some groups (so y_runsome is FALSE)
- y_runsome
logical, whether to run only some groups of tests (so y_runall is FALSE)
- run_these
if y_runsome = TRUE, a vector of group names to test, like 'fips', 'naics', 'webapp', etc. The 'webapp' group runs the combined shinytest2 functionality suite; use 'webapp_individual' only when debugging one-category web app test files.
- skip_these
if y_runall = TRUE, a vector of group names to skip, like 'fips', 'naics', etc. By default, live URL/API integration groups and local draft API tests are skipped so routine unit testing does not depend on network/API availability or a locally running draft Plumber API.
- y_seeresults
logical, whether to show results in console
- y_save
logical, whether to save files of results
- y_tempdir
logical, whether to save in tempdir
- mydir
optional folder
Value
a named list of objects with tables in data.table format, e.g., named 'bytest', 'byfile', 'bygroup', 'params', 'passcount' and other summary stats, etc.
Details
Note these require installing the package testthat first:
[test_ejam()] to test this local source pkg, by group of functions, quietly, summarized.
[devtools::test()] is just a shortcut for [testthat::test_dir()], to run all tests in package.
[testthat::test_local()] to test any local source pkg
[testthat::test_package()] to test the installed version of a package
[testthat::test_check()] to test the installed version of a package, in the way used by R CMD check or [utils::check()]Note: shinytest2 diagnostics are saved on failure, under
file.path(tempdir(), "ejam-shinytest2-logs")
Examples
if (FALSE) { # \dontrun{
biglist <- test_ejam()
biglist <- test_ejam(ask = FALSE, mydir = rstudioapi::selectDirectory())
biglist <- test_ejam(ask = FALSE,
y_runsome = TRUE, run_these = c('test', 'maps'),
mydir = "~/../Downloads/unit testing") # for example
# To run slower tests, live api/url tests for a pre-release check:
Sys.setenv(NOT_CRAN = "true")
EJAM:::test_ejam(
ask = FALSE,
y_runsome = TRUE,
run_these = c("live_url", "live_api"),
skip_these = NULL
)
} # }