At the Appsilon-sponsored Shiny conference this week, RStudio’s Barret Schloerke introduced shinytest2, a new R package designed to enhance the testing capabilities for Shiny web applications. Now available on CRAN, shinytest2 version 0.1.0 enables automated testing of app interactivity using chromote, a headless Chrome browser. This tool aims to simplify the process of ensuring Shiny apps behave as expected across user interactions, significantly improving testing workflows for developers.
One of the highlights of shinytest2 is its record_test()
function, which Schloerke demonstrated during the conference. This function captures user interactions within the testing browser and converts them into code that can be reused for automated testing. The package integrates with the testthat unit testing framework, allowing developers to take snapshots of their app’s state during testing. These snapshots can then be compared across test runs to identify discrepancies. This approach streamlines the often tedious process of manual testing and ensures greater reliability in Shiny applications.
In addition to shinytest2, the conference saw the unveiling of Appsilon’s Rhino framework, a new tool for Shiny app development that emphasizes best practices in software engineering. Rhino encourages developers to build Shiny apps with a modular approach, robust testing, and a focus on user-friendly design. According to the framework’s website, it includes features such as built-in support for unit testing, end-to-end testing with Cypress, CI/CD with GitHub Actions, linting, and dependency management. Appsilon describes Rhino as a way to create Shiny apps “like a full-stack software engineer,” providing a structured yet flexible foundation for app development.
Rhino positions itself as an alternative to the golem framework, a widely-used tool created by ThinkR. Unlike golem, which requires Shiny apps to be structured as R packages, Rhino allows developers more flexibility by not enforcing this structure. Appsilon presenters highlighted that this flexibility can be crucial for certain client projects where rigid file structures aren’t practical. The conference chat sparked a lively debate about the merits of packaging Shiny apps, with some attendees favoring golem’s structured approach for its portability and consistency, while others appreciated Rhino’s freedom to adapt to different development scenarios.
Eric Nantz, host of the Shiny Developer Series podcast, praised Rhino as a promising addition to the ecosystem of Shiny development tools. While a strong advocate of golem for production apps, Nantz expressed interest in Rhino’s hybrid approach, combining an opinionated directory structure with namespace management using the box package. As the Shiny ecosystem continues to grow, tools like shinytest2 and Rhino are poised to empower developers with more options for building and maintaining high-quality applications.