Learn R Programming

⚠️There's a newer version (0.5.1) of this package.Take me there.

shinytest2

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.

Copy Link

Version

Install

install.packages('shinytest2')

Monthly Downloads

14,924

Version

0.5.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Barret Schloerke

Last Published

January 9th, 2026

Functions in shinytest2 (0.5.0)

local_app_support

Attach the Shiny application's support environment
migrate_from_shinytest

Migrate shinytest tests
load_app_env

Load the Shiny application's support environment
compare_screenshot_threshold

Compare screenshots given threshold value
use_shinytest2

Use shinytest2 with your Shiny application
record_test

Launch test event recorder for a Shiny app
register_input_processor

Register an input processor for the test recorder
platform_variant

Platform specific variant
AppDriver

Drive a Shiny application
test_app

Test Shiny applications with testthat