Testing for Shiny Applications

Automated unit testing of Shiny applications through a headless 'Chromium' browser.


shinytest2

CRAN status R-CMD-check Lifecycle: experimental DOI

Manually testing Shiny applications is often laborious, inconsistent, and doesn’t scale well. Whether you are developing new features, fixing bug(s), or simply upgrading dependencies on a serious app where mistakes have real consequences, it is critical to know when regressions are introduced. {shinytest2} provides a streamlined toolkit for unit testing Shiny applications and seamlessly integrates with the popular {testthat} framework for unit testing R code.

{shinytest2} uses {chromote} to render applications in a headless Chrome browser. {chromote} allows for a live preview, better debugging tools, and/or simply using modern JavaScript/CSS.

By simply recording your actions as code and extending them to test the more particular aspects of your application, it will result in fewer bugs and more confidence in future Shiny application development.

Installation

# Install the released version from CRAN
install.packages("shinytest2")

# Or the development version from GitHub:
# install.packages("devtools")
devtools::install_github("rstudio/shinytest2")

Usage

The easiest way to get started is by calling shinytest2::record_test() in your app directory. This will open a Shiny application to record your actions as code. To programmatically create a test, call shinytest2::use_shinytest2_test().

Call shinytest2::use_shinytest2() to create a initial value test file and set up any other infrastructure you may need.

Please check out our Getting Started article for example usage.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("shinytest2")

0.5.1 by Barret Schloerke, 7 months ago


https://rstudio.github.io/shinytest2/, https://github.com/rstudio/shinytest2


Report a bug at https://github.com/rstudio/shinytest2/issues


Browse source code at https://github.com/cran/shinytest2


Authors: Barret Schloerke [cre, aut] (ORCID: , Posit Software , PBC [cph, fnd] (ROR: <https://ror.org/03wc8by49>) , Winston Chang [ctb] (Original author to rstudio/shinytest) , Gábor Csárdi [ctb] (Original author to rstudio/shinytest) , Hadley Wickham [ctb] (Original author to rstudio/shinytest) , Mango Solutions [cph, ccp] (Original author to rstudio/shinytest)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports callr, checkmate, chromote, cli, fs, globals, httr2, jsonlite, lifecycle, pingr, pkgload, R6, rlang, rmarkdown, shiny, withr

Depends on testthat

Suggests box, deSolve, diffobj, ggplot2, golem, knitr, plotly, png, rhino, rstudioapi, shinytest, shinyvalidate, shinyWidgets, showimage, spelling, usethis, vdiffr

Linking to cpp11


Suggested by BayesianNetwork, DrugExposureDiagnostics, FAfA, IDEAFilter, IsoCor, NetSimR, REXoplanets, ReliaShiny, ShinyItemAnalysis, ShinyWizard, SingleCaseES, StabilityApp, VanillaCalendar, aNCA, activAnalyzer, agcounts, bayprior, blockr, blockr.core, blockr.dag, blockr.dock, blockr.ggplot, camtrapR, carwatch, chattr, cofad, commons, conductor, corporaexplorer, courieR, cucumber, data4health, dataganger, dataviewR, datefixR, designer, disaggR, dockViewR, dqcheckrGUI, eAnalytics, epoxy, ggpaintr, glasstabs, gptstudio, gridstackeR, handcodeR, hbsaems, histoslider, howler, inshiny, jsplyr, learnr, mapmixture, mapsf.gui, metainsight, movedesign, nprcgenekeepr, occupationMeasurement, oolong, plotly, qrlabelr, quadkeyr, qviewparsR, r5rgui, reactRouter, reactable.extras, rewind, scoutbaR, selenider, shiny, shiny.destroy, shiny.emptystate, shiny.fluent, shiny.react, shiny.semantic, shiny.webawesome, shinyCohortBuilder, shinyGovstyle, shinyMixR, shinyMobile, shinyNextUI, shinyOAuth, shinybrms, shinychat, shinyds, shinyfilters, shinygenui, shinyphaser, shinyreact, shinyscholar, shinysnap, skpr, sortable, teal, teal.modules.clinical, teal.modules.general, teal.picks, teal.reporter, teal.slice, teal.widgets, tfrmtbuilder, trace, verifyr2, video, visvaR, wowi.


See at CRAN