RStudio’s Barret Schloerke this week offered Shiny developers details of an R package that promises to improve testing for R Shiny applications. shinytest2 version 0.1.0, on CRAN since Wednesday, allows for automated testing of Shiny web app interactivity. That testing is done via chromote, a headless Chrome browser.
During a presentation at a Shiny conference sponsored by consultants Appsilon, Schloerke showed online attendees the package’s
record_test() function. As the name implies, this function records actions taken inside the testing browser and turns those actions into code. This code can then automatically re-run a user’s initial manual activities and check results. Under the hood, shinytest2 takes some snapshots of the application’s state and uses the testthat unit testing package to store various values over time. When a test is re-run, new values can be compared with earlier ones.
For more information about shinytest2, check out the package website.
Also this week, conference host Appsilon unveiled their Rhino framework for building Shiny apps, which the company touts as allowing app creation “like a fullstack software engineer,” according to the package website. “Apply best software engineering practices, modularize your code, test it well, make the UI beautiful, and think about user adoption from the very beginning. Rhino is an opinionated framework with a focus on software engineering practices and development tools.”
Rhino includes built-in support for unit tests, end-to-end testing with Cypress, linting, GitHub Action CI, dependency management, and more.
Rhino is a new alternative to the current popular framework golem, which was created by the ThinkR R consultancy. One of the major differences between the two is that golem requires a Shiny app to be created as an R package, while Rhino does not. Appsilon presenters said that for some of their client work, they need the option to create an app which is not structured as a package because this offers more flexibility as to file structure. There was some lively discussion in the conference chat about the merits of requiring Shiny apps to be R packages, with some liking the portability and well known structures of a package and others preferring the concept of greater choice.
Videos of many of the conference presentations should be available soon on the Appsilon YouTube channel.
In a keynote panel closing the conference, RStudio CTO Joe Cheng was asked about the most interesting recent new developments in Shiny. “We have some incredibly cool things that we can’t talk about,” Cheng responded, calling them “a bunch of secret not ready for public disclosure” work underway. When asked by Shiny Developer Series host Eric Nantz if some of that work might be unveiled at rstudio::conf 2022, Cheng said that was likely. RStudio’s annual conference will be held July 25-28 in Washington, DC, and online.
If you’d like to see tips on getting the most out of R, head to InfoWorld’s Do More With R page with links to more than 50 articles and tutorials.
Copyright © 2022 IDG Communications, Inc.