Manually testing Shiny applications is often laborious, inconsistent,and doesn’t scale well. Whether you are developing new features, fixingbug(s), or simply upgrading dependencies on a serious app where mistakeshave real consequences, it is critical to know when regressions areintroduced.{shinytest2} provides a streamlined toolkit forunit testing Shiny applications and seamlessly integrates with thepopular{testthat} framework for unit testing R code.
{shinytest2} uses{chromote} to renderapplications in a headless Chrome browser.{chromote}allows for a live preview, better debugging tools, and/or simply usingmodern JavaScript/CSS.
By simply recording your actions as code and extending them to testthe more particular aspects of your application, it will result in fewerbugs and more confidence in future Shiny application development.
# Install the released version from CRANinstall.packages("shinytest2")# Or the development version from GitHub:# install.packages("devtools")devtools::install_github("rstudio/shinytest2")The easiest way to get started is by callingshinytest2::record_test() in your app directory. This willopen a Shiny application to record your actions as code. Toprogrammatically create a test, callshinytest2::use_shinytest2_test().
Callshinytest2::use_shinytest2() to create a initialvalue test file and set up any other infrastructure you may need.
Please check out ourGettingStarted article for example usage.