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

  • By Indrajeet Patil
  • Last update: Aug 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: https://indrajeetpatil.github.io/intro-to-snapshot-testing/#/title-slide

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.

Github

https://github.com/IndrajeetPatil/intro-to-snapshot-testing

Comments(2)

  • 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 https://unleash-shiny.rinterface.com/welcome.html was to deploy the app to shinyapps.io and then use an iframe whose src points to the app as the app URL is static.

    GitHub action to deploy app: https://github.com/r-lib/actions/blob/v2-branch/examples/shiny-deploy.yaml