In April 2022, our Full Service partner Appsilon hosted the first-ever Shiny Conference. The conference comprised three days of free, online Shiny content ranging from tips and tricks from the experts, to fascinating community case studies, to examples of enterprise scaling solutions. It provided a shared space for Shiny developers worldwide to learn, network, and share their work.
RStudio was proud to have a presence at the Shiny conference. Barret Schloerke, Software Engineer at RStudio, demonstrated shinytest2, a new R package that facilitates the testing of Shiny applications. To close out the conference, Joe Cheng, CTO at RStudio, and Winston Chang, Software Engineer at RStudio, joined a panel with Filip Stachura, CEO and co-founder of Appsilon. Eric Nantz moderated the session, where the panelists shared reflections on Shiny’s past and excitement for Shiny’s future.
Watch the recordings from the Shiny Conference on Appsilon’s YouTube channel and read our RStudio recap below.
How to Test Shiny Applications
We are all too familiar with this Shiny workflow: add some reactivity, click “Run App,” experiment in the Viewer, and repeat to make changes. A better alternative is to create unit tests. Unit testing breaks up and checks code to ensure it does what you expect. This means fewer bugs, better code structure, easier restarts, and robustness. For R package developers, the testthat package provides a framework for unit testing that is easy to learn, use, and integrate with existing workflows.
Barret revealed shinytest2, a new package on CRAN that leverages the testthat library for Shiny. Shinytest2 provides regression testing for Shiny applications: testing existing behavior for consistency over time. Written entirely in R, shinytest2 is a streamlined toolkit for unit testing Shiny applications.
Shiny developers run the
record_test() function to capture all the events happening in the app and replay them later. Developers can use this saved state to check values. Shinytest2 creates these snapshots with Chromote, a headless Chrome browser, and the
AppDriver object. Thanks to variant support, users can test regardless of operating systems or R versions.
Barret also highlighted Shiny’s
exportTestValues() exports key-value pairs for an app’s names and reactives when it is in test mode to expose intermediate reactive values without slowing down the app in production.
Learn more about shinytest2 on the package website.
Reflecting on Shiny’s Past, Present, and Future
During the Q&A keynote, Joe, Winston, and Felipe answered questions from community members. The session explored Shiny’s past and inquired about its present and future.
The panelists shared how the community adds to the Shiny ecosystem. Feedback on existing tools guides new features and functionality. External packages give developers flexibility and make it easier to follow good practices. App creators share their experiences and expand the community’s knowledge base. Over time, this means more debugging tools and better performance for Shiny apps.
The questions delved into other topics. Community members asked about alternative frameworks such as Streamlit and the use of Shiny in enterprise settings. They wondered what the developers would implement differently if they could go back (camel case, anybody?). The panelists also shared insights on the core Shiny development process and the extensive internal testing for backward compatibility.
There were a few shoutouts to bslib, a package that helps developers make beautiful Shiny apps with bootstrap.
What is on the roadmap? As Joe stated during the panel, it is an “incredibly exciting time for our team.” Barret, Joe, and Winston will present more on Shiny developments at the upcoming rstudio::conf(). Register today!
Many thanks to Appsilon for hosting an inspiring conference for Shiny developers worldwide.
- Check out the 2022 Appsilon Shiny Conference playlist.
- Register for rstudio::conf(2022) to hear more from Barret, Joe, Winston, and others from the Shiny community.
- Interested in learning Shiny or advancing your skills? Check out these upcoming workshops at rstudio::conf(2022):