Introduction to snapshot (aka golden) testing (in R)

  • By Indrajeet Patil
  • Last update: Dec 15, 2022
  • Comments: 2

Introduction to snapshot (aka golden) testing (in R)

In this presentation, I introduce what is snapshot testing, why is it necessary, and its implementation in R in {testthat} package and its extensions.

In particular, the presentation provides a detailed account of how these tests are valuable in testing:

  • text outputs
  • graphical outputs
  • Shiny apps
  • entire files
  • etc.

Slides can be seen here:

Feedback and suggestions welcome!

Code of Conduct

Please note that the intro-to-snapshot-testing project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.



  • 1

    Shinytest2 supports ui.R and server.R

    Separating the app into ui.R and server.R files won't work with {shinytest2}.

    Near line 729, this should be supported. If it is not, please file an issue. Thank you!

  • 2

    Deploy example shiny apps

    You had a comment on how to deploy your shiny app.

    A solution we used for was to deploy the app to and then use an iframe whose src points to the app as the app URL is static.

    GitHub action to deploy app: